
jadex.bdi.examples.cleanerworld.cleaner.CleanerViewerPanel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-bdi Show documentation
Show all versions of jadex-applications-bdi Show documentation
The Jadex BDI applications package contain
several example applications, benchmarks and
testcases using BDI agents.
The newest version!
package jadex.bdi.examples.cleanerworld.cleaner;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import jadex.base.gui.componentviewer.AbstractComponentViewerPanel;
import jadex.base.gui.plugin.IControlCenter;
import jadex.bridge.IExternalAccess;
import jadex.commons.future.Future;
import jadex.commons.future.IFuture;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
/**
* The cleaner panel allows including the cleaner GUI in the JCC.
*/
public class CleanerViewerPanel extends AbstractComponentViewerPanel
{
//-------- attributes --------
/** The cleaner panel. */
protected JComponent panel;
//-------- constructors --------
/**
* Called to initialize the panel.
*/
public IFuture init(IControlCenter jcc, final IExternalAccess component)
{
IFuture fut = super.init(jcc, component);
assert fut.isDone();
final Future ret = new Future();
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
CleanerViewerPanel.this.panel = new CleanerPanel(component);
Timer timer = new Timer(50, new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
CleanerViewerPanel.this.panel.invalidate();
CleanerViewerPanel.this.panel.repaint();
}
});
timer.start();
ret.setResult(null);
}
});
return ret;
}
//-------- AbstractComponentViewerPanel methods --------
/**
* Provide the panel.
*/
public JComponent getComponent()
{
return panel;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy