don't system.ext
[jalview.git] / src / jalview / gui / Desktop.java
index aafd8c0..d79f472 100755 (executable)
@@ -25,11 +25,12 @@ public class Desktop extends jalview.jbgui.GDesktop
 \r
   public Desktop()\r
   {\r
+    Image image =null;\r
     try{\r
       java.net.URL url = getClass().getResource("/BartonGroupBanner.gif");\r
       if(url!=null)\r
       {\r
-        Image image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+        image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
         MediaTracker mt = new MediaTracker(this);\r
         mt.addImage(image, 0);\r
         mt.waitForID(0);\r
@@ -44,17 +45,48 @@ public class Desktop extends jalview.jbgui.GDesktop
     desktop = new JDesktopPane();\r
     setContentPane(desktop);\r
     desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);\r
-    int inset = 150;\r
+\r
     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\r
-    setBounds(inset, inset,\r
-              screenSize.width  - inset*2,\r
-              screenSize.height - inset*2);\r
+    int width = 1200, height = 800;\r
+    if(screenSize.getWidth()<width)\r
+      width = screenSize.width;\r
+    if(screenSize.getHeight()<height)\r
+      height = screenSize.height;\r
+\r
+    setBounds( (int)(screenSize.width-width)/2,\r
+               (int)(screenSize.height-height)/2,\r
+              width ,\r
+              height);\r
+\r
+\r
+   /////////Add a splashscreen on startup\r
+    JInternalFrame frame = new JInternalFrame();\r
+\r
+    SplashScreen splash = new SplashScreen(frame, image);\r
+    frame.setContentPane(splash);\r
+    desktop.add(frame);\r
+    frame.setVisible(true);\r
+    openFrameCount++;\r
+    try\r
+    {\r
+      frame.setSelected(true);\r
+    }\r
+    catch (java.beans.PropertyVetoException e)\r
+    {}\r
+    frame.setResizable(true);\r
+    frame.setSize(845, 200);\r
+    frame.setLocation( (int)((getWidth()-845) /2), (int)((getHeight()-240) /2));\r
+    frame.setClosable(false);\r
+    frame.setIconifiable(false);\r
+    frame.setMaximizable(false);\r
+    frame.setFrameIcon(null);\r
+\r
   }\r
 \r
   public static void addInternalFrame(final JInternalFrame frame, String title, int w, int h)\r
   {\r
-   frame.setVisible(true); //necessary as of 1.3\r
    desktop.add(frame);\r
+   frame.setVisible(true);\r
    openFrameCount++;\r
    try {\r
        frame.setSelected(true);\r
@@ -109,7 +141,6 @@ public class Desktop extends jalview.jbgui.GDesktop
  {\r
    SequenceI [] sequences = null;\r
 \r
-\r
    if (FormatProperties.contains(format))\r
        sequences = FormatAdapter.read(file, protocol, format);\r
 \r
@@ -122,7 +153,7 @@ public class Desktop extends jalview.jbgui.GDesktop
 \r
    }\r
    else\r
-     JOptionPane.showMessageDialog(this,  "Couldn't open file.\n"\r
+     JOptionPane.showInternalMessageDialog(Desktop.desktop,  "Couldn't open file.\n"\r
                           + "Formats currently supported are\n"\r
                           + "Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM"\r
                           ,"Error loading file",\r
@@ -132,7 +163,7 @@ public class Desktop extends jalview.jbgui.GDesktop
 \r
  public void inputURLMenuItem_actionPerformed(ActionEvent e)\r
  {\r
-   String url = JOptionPane.showInputDialog(this,"Enter url of input file",\r
+   String url = JOptionPane.showInternalInputDialog(Desktop.desktop,"Enter url of input file",\r
                                             "Input alignment from URL",\r
                                             JOptionPane.QUESTION_MESSAGE);\r
    if (url == null)\r
@@ -143,7 +174,7 @@ public class Desktop extends jalview.jbgui.GDesktop
    System.out.println(format +" format");\r
    if (format.equals("URL NOT FOUND"))\r
    {\r
-     JOptionPane.showMessageDialog(this,"Couldn't locate " + url,\r
+     JOptionPane.showInternalMessageDialog(Desktop.desktop,"Couldn't locate " + url,\r
                                    "URL not found",\r
                                    JOptionPane.WARNING_MESSAGE);\r
      return;\r
@@ -155,7 +186,7 @@ public class Desktop extends jalview.jbgui.GDesktop
  public void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
  {\r
    CutAndPasteTransfer cap = new CutAndPasteTransfer(true);\r
-   int accept =  JOptionPane.showInternalOptionDialog(desktop, cap, "Cut & paste Alignment File",\r
+   int accept =  JOptionPane.showInternalOptionDialog(Desktop.desktop, cap, "Cut & paste Alignment File",\r
                                        JOptionPane.YES_NO_CANCEL_OPTION,\r
                                        JOptionPane.PLAIN_MESSAGE,\r
                                        null,\r
@@ -178,7 +209,7 @@ public class Desktop extends jalview.jbgui.GDesktop
         af.statusBar.setText("Successfully pasted alignment file");\r
       }\r
       else\r
-        JOptionPane.showMessageDialog(this, "Couldn't read the pasted text.\n"\r
+        JOptionPane.showInternalMessageDialog(Desktop.desktop, "Couldn't read the pasted text.\n"\r
                                       +"Formats currently supported are\n"\r
                                       +"Fasta, MSF, Clustal, BLC, PIR, MSP or PFAM",\r
                                       "Error parsing text", JOptionPane.WARNING_MESSAGE);\r
@@ -192,8 +223,7 @@ public class Desktop extends jalview.jbgui.GDesktop
 */\r
  public void quit_actionPerformed(ActionEvent e)\r
  {\r
-   this.setVisible(false);\r
-   System.exit(0);\r
+   jalview.bin.Jalview.applet.destroy();\r
  }\r
 \r
 \r
@@ -206,9 +236,9 @@ public class Desktop extends jalview.jbgui.GDesktop
 \r
  public void aboutMenuItem_actionPerformed(ActionEvent e)\r
  {\r
-   JOptionPane.showInternalMessageDialog(desktop,\r
+   JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
                                          "JalView 2005"\r
-                                       +"\nAuthors:  Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse and Geoff Barton."\r
+                                       +"\nAuthors:  Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton."\r
                                        +"\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee."\r
                                        +"\nIf  you use JalView, please cite:  \"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"",\r
                                          "About Jalview",\r
@@ -218,7 +248,7 @@ public class Desktop extends jalview.jbgui.GDesktop
  public void documentationMenuItem_actionPerformed(ActionEvent e)\r
  {\r
    try{\r
-     jalview.util.BrowserLauncher.openURL("http://jalview.org/documentation.html");\r
+     jalview.util.BrowserLauncher.openURL("http://www.jalview.org/documentation.html");\r
    }catch(Exception ex){}\r
  }\r
 \r