如何在另一个Gui中开始JADE Gui? [英] How to start JADE Gui within another Gui?

查看:305
本文介绍了如何在另一个Gui中开始JADE Gui?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在另一个Gui中开始JADE Gui?假设我的Gui上有一个按钮。点击该按钮后,JADE Gui将启动。

How to start JADE Gui within another Gui? Let's say I have a button on my Gui. After hitting that button the JADE Gui will started.

这可能吗?如果是,怎么做?

Is this possible? If yes, how?

提前致谢。

问候

推荐答案

我假设JADE Gui你的意思JADE RMA

I'm assuming by JADE Gui you mean the JADE RMA

由于RMA本身就是一个代理,显示RMA gui只是创建和启动RMA代理的问题。

Since the RMA is itself an Agent, showing the RMA gui is simply a matter of creating and starting the RMA agent.

如果你是通过代码执行此操作(即不是通过命令行或gui),你必须有一个容器控制器的引用,你想要启动它,你只需要在它上面调用createAgent()方法。

If you were doing this through code (ie. not through the command-line or the gui), you would have to have a reference to the container controller for the container that you would like to start it on, and you would just call the createAgent() method on it.

import jade.wrapper.AgentController;
import jade.wrapper.ContainerController;

...

ContainerController myContainer;

// .. load a container into the above variable ..

try {
    AgentController rma = myContainer.createNewAgent("rma", "jade.tools.rma.rma", null);
    rma.start();
} catch(StaleProxyException e) {
    e.printStackTrace();
}

你可以从这样的代码开始一个主容器

You can start a main container from code like this

import jade.core.Runtime;
import jade.core.Profile;
import jade.core.ProfileImpl;

...

Runtime myRuntime = Runtime.instance();

// prepare the settings for the platform that we're going to start
Profile myProfile = new ProfileImpl();

// create the main container
myContainer = myRuntime.createMainContainer(myProfile);

或者你可以启动一个普通的代理商容器并连接到这样的外部容器

Or you can start a normal agent container and connect to an external container like this

import jade.core.Runtime;
import jade.core.Profile;
import jade.core.ProfileImpl;

...

Runtime myRuntime = Runtime.instance();

// prepare the settings for the platform that we're going to connect to
Profile myProfile = new ProfileImpl();
myProfile.setParameter(Profile.MAIN_HOST, "myhost");
myProfile.setParameter(Profile.MAIN_PORT, "1099");

// create the agent container
myContainer = myRuntime.createAgentContainer(myProfile);

参考:使用JADE,Fabio Luigi Bellifemine,Giovanni Caire,Dominic Greenwood开发多代理系统。

Reference: Developing Multi-Agent Systems with JADE, Fabio Luigi Bellifemine, Giovanni Caire, Dominic Greenwood.

这篇关于如何在另一个Gui中开始JADE Gui?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆