MaDKit forum

Welcome All !
Please, use explicit topic names when creating new threads. Thanks.

You are not logged in.

#1 2016-05-03 21:13:08

oxality
Member
Registered: 2016-02-24
Posts: 10

Suppress Viewer Windows

This may seem a bit odd, but how would you hide the viewer JFrame that appears during simulations?

I am trying to consolidate all the windows into a single new JFrame, but the old JFrames still appear.

I have tried

launch(agent, false)

and

@Override
public void setupPanel{
this.setVisible(false);
}

I also need this solution to work for the watcher control and information JFrames, but I have not begun to investigate those just yet.

thanks

Offline

#2 2016-05-04 09:48:06

fmichel
Administrator
From: Montpellier
Registered: 2009-03-24
Posts: 172
Website

Re: Suppress Viewer Windows

Hi,

Maybe that you could take a look at the tutorial on GUI that explains the three ways of making an agent's GUI : 1. default, 2 custom, 3 independent :  http://www.madkit.net/madkit/tutorials/ … index.html

Also, I guess that you are extending SwingViewer, which GUI is forced on start-up using createGUIOnStartUp() in its constructor, because there is no point in using the SwingViewer class otherwise as it extends the Watcher class for defining a default GUI for simulation (which does not mean that you cannot customize the SwingViewer'GUI as will, see the bees demo examples for instance).

So, my advice would be to either (1) create your own version of SwingViewer starting from its source code, (2) customize the SwingViewer frame like it is done in the bees demo or (3) start from scratch by extending Watcher and using the independent GUI method to use your own (which is probably what you want to do).

Offline

#3 2016-05-04 22:43:57

oxality
Member
Registered: 2016-02-24
Posts: 10

Re: Suppress Viewer Windows

Ah thank you, thats exactly what I wanted

Offline

Board footer