Author: jflesch
Date: 2008-01-26 12:41:48 +0000 (Sat, 26 Jan 2008)
New Revision: 17301

Modified:
   trunk/apps/Thaw/src/thaw/core/MainWindow.java
Log:
Make the main window remember its state when closing thaw (maximised, etc)

Modified: trunk/apps/Thaw/src/thaw/core/MainWindow.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/MainWindow.java       2008-01-26 12:28:57 UTC 
(rev 17300)
+++ trunk/apps/Thaw/src/thaw/core/MainWindow.java       2008-01-26 12:41:48 UTC 
(rev 17301)
@@ -197,7 +197,7 @@
                core.getConnectionManager().addObserver(this);

                if (core.getConfig().getValue("mainWindowSizeX") != null
-                   && core.getConfig().getValue("mainWindowSizeY") != null) {
+                   && core.getConfig().getValue("mainWindowSizeY") != null) {  
            
                        try {
                                
mainWindow.setSize(Integer.parseInt(core.getConfig().getValue("mainWindowSizeX")),
                                                   
Integer.parseInt(core.getConfig().getValue("mainWindowSizeY")));
@@ -205,6 +205,10 @@
                                Logger.warning(this, "Exception while setting 
the main window size");
                        }
                }
+               
+               if (core.getConfig().getValue("mainWindowState") != null) {
+                       
mainWindow.setExtendedState(Integer.parseInt(core.getConfig().getValue("mainWindowState")));
+               }

        }

@@ -228,8 +232,9 @@
         * Make the window visible or not.
         */
        public void setVisible(final boolean v) {
-               if (!v || !core.isStopping())
+               if (!v || !core.isStopping()) {
                        mainWindow.setVisible(v);
+               }
        }


@@ -522,6 +527,8 @@
                                                  Integer.toString((new 
Double(size.getWidth())).intValue()));
                        core.getConfig().setValue("mainWindowSizeY",
                                                  Integer.toString((new 
Double(size.getHeight())).intValue()));
+                       core.getConfig().setValue("mainWindowState",
+                                                 
Integer.toString(mainWindow.getExtendedState()));
                }

                if(core == null) {


Reply via email to