Java 如何在另一个Gui中启动JADE Gui?
如何在另一个Gui中启动JADE Gui?假设我的Gui上有一个按钮。点击该按钮后,JADE Gui将启动 这可能吗?如果是,如何进行 提前谢谢Java 如何在另一个Gui中启动JADE Gui?,java,agents-jade,Java,Agents Jade,如何在另一个Gui中启动JADE Gui?假设我的Gui上有一个按钮。点击该按钮后,JADE Gui将启动 这可能吗?如果是,如何进行 提前谢谢 问候我想你说的玉桂是指玉 由于RMA本身就是一个代理,因此显示RMA gui只需创建和启动RMA代理即可 如果您是通过代码(即,不是通过命令行或gui)执行此操作,则必须对要启动它的容器的容器控制器进行引用,并且只需对其调用createAgent()方法即可 import jade.wrapper.AgentController; import jad
问候我想你说的玉桂是指玉 由于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);
或者,您可以启动一个普通代理容器,然后像这样连接到一个外部容器
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一起开发多智能体系统。可能与油井重复,答案是gold。他们的指南和他们的代码一样已经过时了。谢谢:)