thread safe plugin startup

This commit is contained in:
fros4943 2007-07-17 21:21:24 +00:00
parent 61482fec43
commit 598f4e94cd

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: SimControl.java,v 1.6 2007/04/02 16:02:32 fros4943 Exp $
* $Id: SimControl.java,v 1.7 2007/07/17 21:21:24 fros4943 Exp $
*/
package se.sics.cooja.plugins;
@ -83,6 +83,8 @@ public class SimControl extends VisPlugin {
JButton button;
JPanel smallPanel;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
// Register as tickobserver
simulation.addTickObserver(tickObserver = new Observer() {
public void update(Observable obs, Object obj) {
@ -119,6 +121,8 @@ public class SimControl extends VisPlugin {
simulationTime.setText("Current simulation time: " + simulation.getSimulationTime());
}
});
}
});
// Main panel