gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 23:00:37 24 4
gpt4 key购买 nike

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

这可能吗?如果是,如何?

提前致谢。

问候

最佳答案

我假设 JADE Gui 是指 JADE RMA

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

如果您是通过代码(即不是通过命令行或图形用户界面)执行此操作,则必须引用要启动它的容器的容器 Controller ,并且您会只需对其调用 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 开发多代理系统。

关于java - 如何在另一个 Gui 中启动 JADE Gui?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17646076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com