Splash screen is not added using normal method, prevents null paint bug
authoramwaterhouse <Andrew Waterhouse>
Fri, 4 May 2007 10:32:03 +0000 (10:32 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 4 May 2007 10:32:03 +0000 (10:32 +0000)
src/jalview/gui/Desktop.java
src/jalview/gui/SplashScreen.java

index 0310f2a..263eb18 100755 (executable)
@@ -65,31 +65,11 @@ public class Desktop
     instance = this;
     doVamsasClientCheck();
     doGroovyCheck();
-    Image image = null;
 
 
-    try
-    {
-      java.net.URL url = getClass().getResource("/images/logo.gif");
-
-      if (url != null)
-      {
-        image = java.awt.Toolkit.getDefaultToolkit().createImage(url);
-
-        MediaTracker mt = new MediaTracker(this);
-        mt.addImage(image, 0);
-        mt.waitForID(0);
-        setIconImage(image);
-      }
-    }
-    catch (Exception ex)
-    {
-    }
-
     setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
-  // desktop = new MyDesktopPane(true);
     desktop = new JDesktopPane();
     desktop.setBackground(Color.white);
     getContentPane().setLayout(new BorderLayout());
@@ -141,15 +121,8 @@ public class Desktop
 
     /////////Add a splashscreen on startup
     /////////Add a splashscreen on startup
-    JInternalFrame frame = new JInternalFrame();
-
-    SplashScreen splash = new SplashScreen(frame, image);
-    frame.setContentPane(splash);
-    frame.setLayer(JLayeredPane.PALETTE_LAYER);
-    frame.setLocation( (int) ( (getWidth() - 750) / 2),
-                      (int) ( (getHeight() - 160) / 2));
+    new SplashScreen();
 
-    addInternalFrame(frame, "", 750, 160, false);
 
     discoverer = new jalview.ws.Discoverer(); // Only gets started if gui is displayed.
   }
@@ -1112,23 +1085,23 @@ public class Desktop
     {
       groovyShell = new JMenuItem();
       groovyShell.setText("Groovy Shell...");
-      groovyShell.addActionListener(new ActionListener() 
+      groovyShell.addActionListener(new ActionListener()
       {
           public void actionPerformed(ActionEvent e) {
               groovyShell_actionPerformed(e);
-          }  
+          }
       });
       toolsMenu.add(groovyShell);
       groovyShell.setVisible(true);
     }
   }
-  /** 
+  /**
    * Accessor method to quickly get all the AlignmentFrames
-   * loaded.  
-   */    
+   * loaded.
+   */
   protected AlignFrame[] getAlignframes() {
     JInternalFrame[] frames = Desktop.desktop.getAllFrames();
-    
+
     if (frames == null)
     {
       return null;
index a033ec7..8b92644 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
@@ -99,6 +127,7 @@ public class SplashScreen
   {\r
     try\r
     {\r
+\r
       iframe.setClosed(true);\r
     }\r
     catch (Exception ex)\r