showInternalInputDialog
authoramwaterhouse <Andrew Waterhouse>
Wed, 1 Dec 2004 17:09:14 +0000 (17:09 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 1 Dec 2004 17:09:14 +0000 (17:09 +0000)
src/jalview/gui/Desktop.java
src/jalview/gui/GroupEditor.java
src/jalview/gui/IdPanel.java

index aafd8c0..a1e88be 100755 (executable)
@@ -22,14 +22,16 @@ public class Desktop extends jalview.jbgui.GDesktop
   public static JDesktopPane desktop;\r
   static int openFrameCount = 0;\r
   static final int xOffset = 30, yOffset = 30;\r
+  static boolean splashScreenVisible = false;\r
 \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,16 +46,41 @@ 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
+    setBounds( (int)(screenSize.getWidth()-1200)/2,\r
+               (int)(screenSize.getHeight()-800)/2,\r
+              1200 ,\r
+              800);\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
+    addInternalFrame(frame, "",820,200);\r
+    splashScreenVisible = true;\r
+\r
+    frame.setLocation( (int)((getWidth()-820) /2), (int)((getHeight()-240) /2));\r
+    frame.setClosable(false);\r
+    frame.setIconifiable(false);\r
+    frame.setMaximizable(false);\r
+    frame.setFrameIcon(null);*/\r
+  }\r
+\r
+  public static void splashScreenClosing()\r
+  {\r
+    splashScreenVisible = false;\r
+    JInternalFrame [] frames  = desktop.getAllFrames();\r
+    for(int i=0; i<frames.length; i++)\r
+      frames[i].setVisible(true);\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
+   if(!splashScreenVisible)\r
+      frame.setVisible(true); //necessary as of 1.3\r
    desktop.add(frame);\r
    openFrameCount++;\r
    try {\r
@@ -109,7 +136,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 +148,7 @@ public class Desktop extends jalview.jbgui.GDesktop
 \r
    }\r
    else\r
-     JOptionPane.showMessageDialog(this,  "Couldn't open file.\n"\r
+     JOptionPane.showInternalMessageDialog(this,  "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 +158,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(this,"Enter url of input file",\r
                                             "Input alignment from URL",\r
                                             JOptionPane.QUESTION_MESSAGE);\r
    if (url == null)\r
@@ -143,7 +169,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(this,"Couldn't locate " + url,\r
                                    "URL not found",\r
                                    JOptionPane.WARNING_MESSAGE);\r
      return;\r
@@ -178,7 +204,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(this, "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
index e9ef492..5b6df2b 100755 (executable)
@@ -144,7 +144,7 @@ public class GroupEditor extends GGroupEditor
 \r
   protected void groupName_actionPerformed(ActionEvent e)\r
   {\r
-    String reply = JOptionPane.showInputDialog(this, "Enter new group name", "Edit group name", JOptionPane.QUESTION_MESSAGE);\r
+    String reply = JOptionPane.showInternalInputDialog(this, "Enter new group name", "Edit group name", JOptionPane.QUESTION_MESSAGE);\r
     if(reply==null)\r
       return;\r
 \r
index 5e15283..0329926 100755 (executable)
@@ -103,7 +103,7 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
       if( javax.swing.SwingUtilities.isRightMouseButton(e))\r
       {\r
         String id = av.getAlignment().getSequenceAt(seq).getName();\r
-        String s = (String)JOptionPane.showInputDialog(\r
+        String s = (String)JOptionPane.showInternalInputDialog(\r
                     this,\r
                     "Edit sequence name",\r
                     "Edit sequence name",\r