如何在另一个 Gui 中启动 JADE Gui?

2024-05-06

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

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

提前致谢。

Regards


我假设 JADE Gui 你指的是 JADERMA http://jade.tilab.com/doc/tools/rma/html/intro.htm

由于 RMA 本身就是一个代理,因此显示 RMA gui 只需创建并启动 RMA 代理即可。

如果您通过代码(即不是通过命令行或 GUI)执行此操作,则必须引用您想要启动容器的容器控制器,并且您只需调用其上的 createAgent() 方法。

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();
}

您可以从这样的代码启动主容器

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);

或者您可以启动一个普通的代理容器并连接到外部容器,如下所示

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。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在另一个 Gui 中启动 JADE Gui? 的相关文章

随机推荐