Saves screen size on exit
authoramwaterhouse <Andrew Waterhouse>
Tue, 15 Mar 2005 17:10:46 +0000 (17:10 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 15 Mar 2005 17:10:46 +0000 (17:10 +0000)
src/jalview/gui/Desktop.java

index 3b13016..bfbdc1d 100755 (executable)
@@ -49,16 +49,36 @@ public class Desktop extends jalview.jbgui.GDesktop
     desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);\r
 \r
     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\r
-    int width = 900, height = 650;\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
+    String x = jalview.bin.Cache.getProperty("SCREEN_X");\r
+    String y = jalview.bin.Cache.getProperty("SCREEN_Y");\r
+    String width = jalview.bin.Cache.getProperty("SCREEN_WIDTH");\r
+    String height = jalview.bin.Cache.getProperty("SCREEN_HEIGHT");\r
+\r
+    if(x!=null && y!=null && width!=null && height!=null)\r
+    {\r
+      setBounds( Integer.parseInt(x), Integer.parseInt(y),\r
+                 Integer.parseInt(width), Integer.parseInt(height));\r
+    }\r
+    else\r
+      setBounds( (int)(screenSize.width-900)/2,\r
+           (int)(screenSize.height-650)/2,\r
+          900 ,\r
+          650);\r
+\r
+this.addWindowListener(new WindowAdapter()\r
+{\r
+public void windowClosing(WindowEvent evt)\r
+{\r
+ jalview.bin.Cache.setProperty("SCREEN_X",\r
+                               getBounds().x + "");\r
+ jalview.bin.Cache.setProperty("SCREEN_Y",\r
+                               getBounds().y + "");\r
+ jalview.bin.Cache.setProperty("SCREEN_WIDTH", getWidth() + "");\r
+ jalview.bin.Cache.setProperty("SCREEN_HEIGHT", getHeight() + "");\r
+}\r
+});\r
+\r
+/////////Add a splashscreen on startup\r
 \r
 \r
    /////////Add a splashscreen on startup\r