/* Copyright 2002 Graham Ritchie This file is part of Intellego. Intellego is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Intellego is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Intellego; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package main; import simworldobjects.*; import intellego.Intellego; import util.*; import interfaces.*; import real.*; import java.awt.*; import java.lang.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.io.*; import java.util.*; /** * Provides a user interface for a simulation * * @author Graham Ritchie */ public class SimUI extends JInternalFrame implements Runnable { private Container mainContainer; private SimDisplay display=null; private JLayeredPane mainPane; private LinkedList controllerList; private LinkedList robotList; private SimWorld world=null; private boolean running=false; private boolean paused=false; private int UPDATE_TIME=30; private static int screenWidth=1000; private static int screenHeight=800; private static final String NO_CLASS="__NOCLASS__"; /** * Sets up the main window for an empty simulation */ public SimUI() { // window setup super("Simulator:",true,true,true,true); setSize(screenWidth,screenHeight); setupWindow(); // stop the simulation when the window closes. addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) { Intellego.addToLog("SimUI.init(): simulator quitting"); // stop running (if we are) running=false; // stop all the controllers for (int i=0;i