Restructure Jemmy tests prototype
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 21 Sep 2008 10:22:23 +0000 (10:22 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 21 Sep 2008 10:22:23 +0000 (10:22 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1603 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

12 files changed:
org.argeo.slc.autoui/pom.xml
org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/AutoUiActivator.java
org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/Main.java [new file with mode: 0644]
org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/internal/AutoUiApplicationJemmy.java [deleted file]
sandbox/argeo.slc.jemmytest/pom.xml
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/AutoUiApplicationJemmy.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/JemmyTestActivator.java
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/ui/SwingTestUi.java [deleted file]
sandbox/argeo.slc.testui/.classpath [new file with mode: 0644]
sandbox/argeo.slc.testui/.project [new file with mode: 0644]
sandbox/argeo.slc.testui/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java [new file with mode: 0644]

index 14d16f27006bc1a5e6f24cfd7da4c7b01bcbb190..9722210baa105ad106d96765d7645cb10b2cb044 100644 (file)
@@ -31,9 +31,6 @@
                                                <Export-Package>
                                                        org.argeo.slc.autoui.*
                                                </Export-Package>
-                                               <Import-Package>
-                                                       org.argeo.slc.jemmytest.ui.*;resolution=optional
-                                               </Import-Package>
                                                <!-- 
                                                        <Export-Service>
                                                        org.argeo.slc.autoui.AutoUiApplication
                        <artifactId>org.argeo.dep.jemmy.nb61</artifactId>
                </dependency>
 
-               <!-- OSGi -->
+               <!-- OSGi 
                <dependency>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>org.osgi.core</artifactId>
                        <version>1.0.0</version>
-               </dependency>
-               <!-- 
+               </dependency>-->
+               
                        <dependency>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>org.apache.felix.main</artifactId>
-                       </dependency> -->
+                       </dependency> 
        </dependencies>
 </project>
\ No newline at end of file
index 463a10bf3e0441fde886b3fdde6752fd5b179003..cc78b2911440ef35f0d76688a377a61179ad9186 100644 (file)
@@ -1,8 +1,5 @@
 package org.argeo.slc.autoui;
 
-import java.util.Properties;
-
-import org.argeo.slc.autoui.internal.AutoUiApplicationJemmy;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 
@@ -10,12 +7,6 @@ public class AutoUiActivator implements BundleActivator {
 
        public void start(BundleContext context) throws Exception {
                stdOut("AutoUi started");
-               Properties properties = new Properties();
-               AutoUiApplicationJemmy applicationJemmy = new AutoUiApplicationJemmy();
-               context.registerService(AutoUiApplication.class.getName(),
-                               applicationJemmy, properties);
-               context.registerService(Runnable.class.getName(), applicationJemmy,
-                               properties);
        }
 
        public void stop(BundleContext context) throws Exception {
diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/Main.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/Main.java
new file mode 100644 (file)
index 0000000..638ba01
--- /dev/null
@@ -0,0 +1,201 @@
+package org.argeo.slc.autoui;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.felix.framework.Felix;
+import org.apache.felix.framework.cache.BundleCache;
+import org.apache.felix.framework.util.FelixConstants;
+import org.apache.felix.framework.util.StringMap;
+import org.apache.felix.main.AutoActivator;
+import org.netbeans.jemmy.ClassReference;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+public class Main {
+
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               try {
+                       // Create a temporary bundle cache directory and
+                       // make sure to clean it up on exit.
+                       final File cachedir = File.createTempFile(
+                                       "felix.example.servicebased", null);
+                       cachedir.delete();
+                       Runtime.getRuntime().addShutdownHook(new Thread() {
+                               public void run() {
+                                       deleteFileOrDir(cachedir);
+                               }
+                       });
+
+                       String mavenBase = "file:/home/mbaudier/.m2/repository/";
+                       String uiPackage = "org.argeo.slc.testui";
+                       Map configMap = new StringMap(false);
+                       configMap
+                                       .put(
+                                                       Constants.FRAMEWORK_SYSTEMPACKAGES,
+                                                       "org.osgi.framework; version=1.4.0,"
+                                                                       + "org.osgi.service.packageadmin; version=1.2.0,"
+                                                                       + "org.osgi.service.startlevel; version=1.1.0,"
+                                                                       + "org.osgi.service.url; version=1.0.0,"
+                                                                       + "org.osgi.util.tracker; version=1.3.3,"
+                                                                       /*+ "org.apache.felix.example.servicebased.host.service; version=1.0.0,"*/
+                                                                       + "org.argeo.slc.autoui; version=0.10.3.SNAPSHOT,"
+                                                                       + uiPackage+","
+                                                                       + "javax.swing");
+                       configMap
+                                       .put(
+                                                       AutoActivator.AUTO_START_PROP + ".1",
+                                                       mavenBase
+                                                                       + "org/apache/felix/org.apache.felix.shell/1.0.2/org.apache.felix.shell-1.0.2.jar "
+                                                                       + mavenBase
+                                                                       + "org/apache/felix/org.apache.felix.shell.tui/1.0.2/org.apache.felix.shell.tui-1.0.2.jar "
+                                                                       + mavenBase
+                                                                       + "org/argeo/dep/jemmy/org.argeo.dep.jemmy.nb61/0.2.0/org.argeo.dep.jemmy.nb61-0.2.0.jar "
+                                                                       + mavenBase
+                                                                       + "org/argeo/slc/sandbox/org.argeo.slc.sandbox.jemmytest/0.1.1-SNAPSHOT/org.argeo.slc.sandbox.jemmytest-0.1.1-SNAPSHOT.jar");
+                       configMap.put(FelixConstants.LOG_LEVEL_PROP, "1");
+                       configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, cachedir
+                                       .getAbsolutePath());
+
+                       // Create list to hold custom framework activators.
+                       List list = new ArrayList();
+                       // Add activator to process auto-start/install properties.
+                       list.add(new AutoActivator(configMap));
+                       // Add our own activator.
+                       list.add(new AutoUiActivator());
+
+                       BundleContext context = null;
+                       try {
+                               // Now create an instance of the framework.
+                               Felix felix = new Felix(configMap, list);
+                               felix.start();
+
+                               context = felix.getBundleContext();
+
+                               // Bundle jemmyTestBundle = context
+                               // .installBundle(mavenBase
+                               // +
+                               // "org/argeo/slc/sandbox/org.argeo.slc.sandbox.jemmytest/0.1.1-SNAPSHOT/org.argeo.slc.sandbox.jemmytest-0.1.1-SNAPSHOT.jar");
+                               // jemmyTestBundle.start();
+
+                       } catch (Exception ex) {
+                               System.err.println("Could not create framework: " + ex);
+                               ex.printStackTrace();
+                               System.exit(-1);
+                       }
+
+                       
+                       // Start UI
+                       String className = "org.argeo.slc.testui.SwingTestUi";
+                       //String className = SwingTestUi.class.getName();
+                       // String[] args = {};
+                       // SwingTestUi.main(args);
+                       // Start application
+                       ClassReference classReference = new ClassReference(className);
+                       String[] uiArgs = { "noExitOnClose" };
+                       classReference.startApplication(uiArgs);
+
+
+                       
+                       ServiceReference ref = context
+                       .getServiceReference("org.argeo.slc.autoui.AutoUiApplication");
+//                     ServiceReference ref = context
+//                     .getServiceReference("java.lang.Runnable");
+                       Object service = context.getService(ref);
+                       AutoUiActivator.stdOut("service=" + service.getClass());
+                       AutoUiApplication app = (AutoUiApplication) service;
+                       app.execute(null);
+                       // app.execute(null);
+                       
+
+               } catch (Exception e) {
+                       e.printStackTrace();
+                       System.exit(-1);
+               }
+
+               // Felix felix;
+               // // JemmyTestActivator activator;
+               //
+               // // Create a case-insensitive configuration property map.
+               // Map configMap = new StringMap(false);
+               // // Configure the Felix instance to be embedded.
+               // configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
+               // // Add core OSGi packages to be exported from the class path
+               // // via the system bundle.
+               // configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
+               // "org.osgi.framework; version=1.3.0,"
+               // + "org.osgi.service.packageadmin; version=1.2.0,"
+               // + "org.osgi.service.startlevel; version=1.0.0,"
+               // + "org.osgi.service.url; version=1.0.0");
+               // // Explicitly specify the directory to use for caching bundles.
+               // configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "target/cache");
+               //
+               // try {
+               // // Create host activator;
+               // // activator = new JemmyTestActivator();
+               // List list = new ArrayList();
+               // // list.add(activator);
+               // list.add(new Activator());
+               // list.add(new org.apache.felix.shell.impl.Activator());
+               // list.add(new org.apache.felix.bundlerepository.Activator());
+               //
+               // // Now create an instance of the framework with
+               // // our configuration properties and activator.
+               // felix = new Felix(configMap, list);
+               //
+               // // Now start Felix instance.
+               // felix.start();
+               //
+               // Bundle jemmyBundle = felix
+               // .getBundleContext()
+               // .installBundle(
+               // "file:/home/mbaudier/.m2/repository/org/argeo/dep/jemmy/org.argeo.dep.jemmy.nb61/0.2.0/org.argeo.dep.jemmy.nb61-0.2.0.jar");
+               // jemmyBundle.start();
+               // //
+               // // Bundle autoUiBundle = felix
+               // // .getBundleContext()
+               // // .installBundle(
+               // //
+               // "reference:file:/home/mbaudier/dev/src/slc/org.argeo.slc.autoui/");
+               // // autoUiBundle.start();
+               //
+               // Bundle[] bundles = felix.getBundleContext().getBundles();
+               // for (int i = 0; i < bundles.length; i++) {
+               // Bundle bundle = bundles[i];
+               // System.out.println("" + bundle.getBundleId() + "\t"
+               // + bundle.getSymbolicName() + "\t" + bundle.getState()
+               // + "\t" + bundle.getLocation());
+               // }
+               //
+               // // felix.stop();
+               // } catch (Exception ex) {
+               // System.err.println("Could not create framework: " + ex);
+               // ex.printStackTrace();
+               // }
+               //
+       }
+
+       /**
+        * Utility method used to delete the profile directory when run as a
+        * stand-alone application.
+        * 
+        * @param file
+        *            The file to recursively delete.
+        */
+       private static void deleteFileOrDir(File file) {
+               if (file.isDirectory()) {
+                       File[] childs = file.listFiles();
+                       for (int i = 0; i < childs.length; i++) {
+                               deleteFileOrDir(childs[i]);
+                       }
+               }
+               file.delete();
+       }
+
+}
diff --git a/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/internal/AutoUiApplicationJemmy.java b/org.argeo.slc.autoui/src/main/java/org/argeo/slc/autoui/internal/AutoUiApplicationJemmy.java
deleted file mode 100644 (file)
index d220742..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.argeo.slc.autoui.internal;
-
-import org.argeo.slc.autoui.AutoUiActivator;
-import org.argeo.slc.autoui.AutoUiApplication;
-import org.netbeans.jemmy.ClassReference;
-import org.netbeans.jemmy.operators.JButtonOperator;
-import org.netbeans.jemmy.operators.JFrameOperator;
-import org.netbeans.jemmy.operators.JLabelOperator;
-
-public class AutoUiApplicationJemmy implements AutoUiApplication {
-       public void run() {
-               try {
-                       execute(new Object());
-               } catch (Exception e) {
-                       e.printStackTrace();
-                       throw new RuntimeException("Could not execute as Runnable", e);
-               }
-       }
-
-       public Object execute(Object object) throws Exception {
-
-               String className = "org.argeo.slc.jemmytest.ui.SwingTestUi";
-               // String[] args = {};
-               // SwingTestUi.main(args);
-               // Start application
-               ClassReference classReference = new ClassReference(className);
-               String[] args = { "noExitOnClose" };
-               classReference.startApplication(args);
-
-               // Find components
-               JFrameOperator jFrameOperator = new JFrameOperator("HelloWorldSwing");
-               JButtonOperator jButtonOperator = new JButtonOperator(jFrameOperator,
-                               "Button");
-               JLabelOperator jLabelOperator = new JLabelOperator(jFrameOperator,
-                               "Hello World");
-
-               // Execute actions
-               jButtonOperator.push();
-
-               // Performs checks
-               String textAfterPush = jLabelOperator.getText();
-               AutoUiActivator.stdOut("textAfterPush=" + textAfterPush);
-
-               return null;
-       }
-
-}
index 673bd0f8e31923d43f7ac5e7d67d029d28194203..8797af1138ee9cac944bf66f4433093f2d93da07 100644 (file)
                                                <Bundle-SymbolicName>
                                                        ${pom.artifactId}
                                                </Bundle-SymbolicName>
+                                               <Bundle-Activator>
+                                                       org.argeo.slc.jemmytest.JemmyTestActivator
+                                               </Bundle-Activator>
                                                <Import-Package>
-                                                       !org.apache.felix.*,*
+                                                       !org.apache.felix.*,*,javax.swing.*
                                                </Import-Package>
                                                <Export-Package>
                                                        org.argeo.slc.jemmytest.*
                                        <groupId>org.apache.felix</groupId>
                                        <artifactId>org.osgi.core</artifactId>
                                </exclusion>
+                               <exclusion>
+                                       <groupId>org.apache.felix</groupId>
+                       <artifactId>org.apache.felix.main</artifactId>
+                               </exclusion>
                        </exclusions>
                </dependency>
 
@@ -74,7 +81,6 @@
                        <groupId>org.argeo.dep.jemmy</groupId>
                        <artifactId>org.argeo.dep.jemmy.nb61</artifactId>
                        <version>0.2.0</version>
-                       <scope>test</scope>
                </dependency>
                <dependency>
                        <groupId>junit</groupId>
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/AutoUiApplicationJemmy.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/AutoUiApplicationJemmy.java
new file mode 100644 (file)
index 0000000..d15b4fe
--- /dev/null
@@ -0,0 +1,40 @@
+package org.argeo.slc.jemmytest;
+
+import org.argeo.slc.autoui.AutoUiActivator;
+import org.argeo.slc.autoui.AutoUiApplication;
+import org.netbeans.jemmy.ClassReference;
+import org.netbeans.jemmy.operators.JButtonOperator;
+import org.netbeans.jemmy.operators.JFrameOperator;
+import org.netbeans.jemmy.operators.JLabelOperator;
+
+public class AutoUiApplicationJemmy implements AutoUiApplication {
+       public void run() {
+               try {
+                       execute(new Object());
+               } catch (Exception e) {
+                       e.printStackTrace();
+                       throw new RuntimeException("Could not execute as Runnable"
+                                       + e.getMessage());
+               }
+       }
+
+       public Object execute(Object object) throws Exception {
+
+               // Find components
+               JFrameOperator jFrameOperator = new JFrameOperator("HelloWorldSwing");
+               JButtonOperator jButtonOperator = new JButtonOperator(jFrameOperator,
+                               "Button");
+               JLabelOperator jLabelOperator = new JLabelOperator(jFrameOperator,
+                               "Hello World");
+
+               // Execute actions
+               jButtonOperator.push();
+
+               // Performs checks
+               String textAfterPush = jLabelOperator.getText();
+               AutoUiActivator.stdOut("textAfterPush=" + textAfterPush);
+
+               return null;
+       }
+
+}
index 6047f83d6aa9a54bee5740b9a5aebbe3a6a2c1d3..f33855fbc32cec44c859989a39e0bd768e39a68c 100644 (file)
@@ -1,5 +1,8 @@
 package org.argeo.slc.jemmytest;
 
+import java.util.Properties;
+
+import org.argeo.slc.autoui.AutoUiApplication;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceEvent;
@@ -9,6 +12,12 @@ public class JemmyTestActivator implements BundleActivator, ServiceListener {
 
        public void start(BundleContext context) throws Exception {
                stdOut("JemmyTest started");
+               Properties properties = new Properties();
+               AutoUiApplicationJemmy applicationJemmy = new AutoUiApplicationJemmy();
+               context.registerService(AutoUiApplication.class.getName(),
+                               applicationJemmy, properties);
+               context.registerService(Runnable.class.getName(), applicationJemmy,
+                               properties);
 
 //             ServiceReference ref = context
 //                             .getServiceReference("org.argeo.slc.autoui.AutoUiApplication");
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/ui/SwingTestUi.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/jemmytest/ui/SwingTestUi.java
deleted file mode 100644 (file)
index 91dfd12..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.argeo.slc.jemmytest.ui;
-
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.JButton;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-
-public class SwingTestUi {
-       private static void createAndShowGUI(boolean exitOnClose) {
-               // Create and set up the window.
-               JFrame frame = new JFrame("HelloWorldSwing");
-               if (exitOnClose)
-                       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
-               frame.getContentPane().setLayout(new GridLayout(2, 1));
-
-               // Add the ubiquitous "Hello World" label.
-               final JLabel label = new JLabel("Hello World");
-               frame.getContentPane().add(label);
-
-               final JButton button = new JButton("Button");
-               frame.getContentPane().add(button);
-               button.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent e) {
-                               label.setText("Pressed!!");
-                       }
-               });
-
-               // Display the window.
-               frame.pack();
-               frame.setVisible(true);
-       }
-
-       public static void main(String[] args) {
-               boolean noExitOnClose = false;
-               for (int i = 0; i < args.length; i++) {
-                       if (args[i].equals("noExitOnClose")) {
-                               noExitOnClose = true;
-                       }
-               }
-
-               final boolean exitOnClose = !noExitOnClose;
-               javax.swing.SwingUtilities.invokeLater(new Runnable() {
-                       public void run() {
-                               createAndShowGUI(exitOnClose);
-                       }
-               });
-       }
-
-}
diff --git a/sandbox/argeo.slc.testui/.classpath b/sandbox/argeo.slc.testui/.classpath
new file mode 100644 (file)
index 0000000..30a1872
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src/main/java"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/j2sdk1.3.1"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/argeo.slc.testui/.project b/sandbox/argeo.slc.testui/.project
new file mode 100644 (file)
index 0000000..6b8609f
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>argeo.slc.testui</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/sandbox/argeo.slc.testui/.settings/org.eclipse.jdt.core.prefs b/sandbox/argeo.slc.testui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..897ca45
--- /dev/null
@@ -0,0 +1,12 @@
+#Sat Sep 20 12:22:38 GMT+02:00 2008
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.3
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+org.eclipse.jdt.core.compiler.source=1.3
+eclipse.preferences.version=1
diff --git a/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java b/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java
new file mode 100644 (file)
index 0000000..4ff18c7
--- /dev/null
@@ -0,0 +1,53 @@
+package org.argeo.slc.testui;
+
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+
+public class SwingTestUi {
+       private static void createAndShowGUI(boolean exitOnClose) {
+               // Create and set up the window.
+               JFrame frame = new JFrame("HelloWorldSwing");
+               if (exitOnClose)
+                       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+               frame.getContentPane().setLayout(new GridLayout(2, 1));
+
+               // Add the ubiquitous "Hello World" label.
+               final JLabel label = new JLabel("Hello World");
+               frame.getContentPane().add(label);
+
+               final JButton button = new JButton("Button");
+               frame.getContentPane().add(button);
+               button.addActionListener(new ActionListener() {
+                       public void actionPerformed(ActionEvent e) {
+                               label.setText("Pressed!!");
+                       }
+               });
+
+               // Display the window.
+               frame.pack();
+               frame.setVisible(true);
+       }
+
+       public static void main(String[] args) {
+               boolean noExitOnClose = false;
+               for (int i = 0; i < args.length; i++) {
+                       if (args[i].equals("noExitOnClose")) {
+                               noExitOnClose = true;
+                       }
+               }
+
+               final boolean exitOnClose = !noExitOnClose;
+               javax.swing.SwingUtilities.invokeLater(new Runnable() {
+                       public void run() {
+                               createAndShowGUI(exitOnClose);
+                       }
+               });
+       }
+
+}