nullpointer bug fix on consensus thread
[jalview.git] / src / jalview / gui / SplashScreen.java
index a033ec7..c159cd2 100755 (executable)
@@ -43,10 +43,25 @@ public class SplashScreen
    * @param iframe DOCUMENT ME!\r
    * @param i DOCUMENT ME!\r
    */\r
-  public SplashScreen(JInternalFrame iframe, Image i)\r
+  public SplashScreen()\r
   {\r
-    this.iframe = iframe;\r
-    image = i;\r
+    try\r
+    {\r
+      java.net.URL url = getClass().getResource("/images/logo.gif");\r
+\r
+      if (url != null)\r
+      {\r
+        image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+\r
+        MediaTracker mt = new MediaTracker(this);\r
+        mt.addImage(image, 0);\r
+        mt.waitForID(0);\r
+        Desktop.instance.setIconImage(image);\r
+      }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
 \r
     Thread t = new Thread(this);\r
     t.start();\r
@@ -63,6 +78,19 @@ public class SplashScreen
         }\r
       }\r
     });\r
+\r
+    iframe = new JInternalFrame();\r
+    iframe.setFrameIcon(null);\r
+    iframe.setClosable(false);\r
+    iframe.setContentPane(this);\r
+    iframe.setLayer(JLayeredPane.PALETTE_LAYER);\r
+\r
+    Desktop.desktop.add(iframe);\r
+\r
+    iframe.setVisible(true);\r
+    iframe.setBounds( (int) ( (Desktop.instance.getWidth() - 750) / 2),\r
+                      (int) ( (Desktop.instance.getHeight() - 160) / 2),\r
+                      750, 160);\r
   }\r
 \r
   /**\r
@@ -77,7 +105,6 @@ public class SplashScreen
       try\r
       {\r
         Thread.sleep(1000);\r
-        repaint();\r
       }\r
       catch (Exception ex)\r
       {\r
@@ -87,6 +114,8 @@ public class SplashScreen
       {\r
         visible = false;\r
       }\r
+      else\r
+        repaint();\r
     }\r
 \r
     closeSplash();\r
@@ -99,6 +128,7 @@ public class SplashScreen
   {\r
     try\r
     {\r
+\r
       iframe.setClosed(true);\r
     }\r
     catch (Exception ex)\r