How to start JADE Gui within another Gui?

2019-05-28 05:15发布

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?

Thanks in advance.

Regards

1条回答
戒情不戒烟
2楼-- · 2019-05-28 05:45

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

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

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

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

查看更多
登录 后发表回答