From 24cc50590f3815ce0e9cc95855f8c6ff033dc64f Mon Sep 17 00:00:00 2001 From: fros4943 Date: Sat, 24 Mar 2007 00:42:51 +0000 Subject: [PATCH] minor changes when dusting up quick-start --- tools/cooja/java/se/sics/cooja/GUI.java | 30 +++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/GUI.java b/tools/cooja/java/se/sics/cooja/GUI.java index 6c91a4336..f89abe60c 100644 --- a/tools/cooja/java/se/sics/cooja/GUI.java +++ b/tools/cooja/java/se/sics/cooja/GUI.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: GUI.java,v 1.33 2007/03/23 23:34:33 fros4943 Exp $ + * $Id: GUI.java,v 1.34 2007/03/24 00:42:51 fros4943 Exp $ */ package se.sics.cooja; @@ -187,8 +187,11 @@ public class GUI { /** * Creates a new COOJA Simulator GUI. + * + * @param desktop Desktop pane + * @param createSimDialog If true, a create simulation dialog will be displayed at startup */ - public GUI(JDesktopPane desktop) { + public GUI(JDesktopPane desktop, boolean createSimDialog) { myGUI = this; mySimulation = null; myDesktopPane = desktop; @@ -228,7 +231,7 @@ public class GUI { } } - if (frame != null) { + if (createSimDialog && frame != null) { SwingUtilities.invokeLater(new Runnable() { public void run() { myGUI.doCreateSimulation(true); @@ -535,7 +538,7 @@ public class GUI { JDesktopPane desktop = new JDesktopPane(); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); - GUI gui = new GUI(desktop); + GUI gui = new GUI(desktop, true); JComponent newContentPane = gui.getDesktopPane(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); @@ -614,7 +617,7 @@ public class GUI { // Create and set up the content pane. JDesktopPane desktop = new JDesktopPane(); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); - GUI gui = new GUI(desktop); // loads external settings and creates initial + GUI gui = new GUI(desktop, false); // loads external settings and creates initial // project config // Add menu bar @@ -1794,12 +1797,12 @@ public class GUI { try { newSim = loadSimulationConfig(fileToLoad, quick); addToFileHistory(fileToLoad); - if (progressDialog != null && progressDialog.isVisible()) { + if (progressDialog != null && progressDialog.isDisplayable()) { progressDialog.dispose(); } } catch (UnsatisfiedLinkError e) { logger.warn("Could not reopen libraries: " + e.getMessage()); - if (progressDialog != null) + if (progressDialog != null && progressDialog.isDisplayable()) progressDialog.dispose(); newSim = null; } @@ -1823,7 +1826,7 @@ public class GUI { loadThread.interrupt(); doRemoveSimulation(false); } - if (progressDialog != null && progressDialog.isVisible()) { + if (progressDialog != null && progressDialog.isDisplayable()) { progressDialog.dispose(); } } @@ -1926,12 +1929,12 @@ public class GUI { Simulation newSim = null; try { newSim = loadSimulationConfig(new StringReader(configXML), true); - if (progressDialog != null && progressDialog.isVisible()) { + if (progressDialog != null && progressDialog.isDisplayable()) { progressDialog.dispose(); } } catch (UnsatisfiedLinkError e) { logger.fatal("Could not reopen libraries: " + e.getMessage()); - if (progressDialog != null && progressDialog.isVisible()) { + if (progressDialog != null && progressDialog.isDisplayable()) { progressDialog.dispose(); } newSim = null; @@ -1940,7 +1943,7 @@ public class GUI { myGUI.setSimulation(newSim); } - if (progressDialog != null && progressDialog.isVisible()) { + if (progressDialog != null && progressDialog.isDisplayable()) { progressDialog.dispose(); } } @@ -1958,7 +1961,7 @@ public class GUI { loadThread.interrupt(); doRemoveSimulation(false); } - if (progressDialog != null && progressDialog.isVisible()) { + if (progressDialog != null && progressDialog.isDisplayable()) { progressDialog.dispose(); } } @@ -2572,13 +2575,12 @@ public class GUI { if (!ok) System.exit(1); - // Check if simulator should be quick-started } else if (args.length > 0 && args[0].startsWith("-nogui")) { // No GUI start-up javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { - new GUI(null); + new GUI(null, false); } });