]> git.gag.com Git - debian/openrocket/blobdiff - src/net/sf/openrocket/gui/util/GUIUtil.java
introduction tour
[debian/openrocket] / src / net / sf / openrocket / gui / util / GUIUtil.java
index 1123e6520ad4c1ac995acf35546a69a149853577..4ee74ba4e83edfc75245c9020ecaf00e26d9ba84 100644 (file)
@@ -77,7 +77,6 @@ import net.sf.openrocket.startup.Application;
 import net.sf.openrocket.util.BugException;
 import net.sf.openrocket.util.Invalidatable;
 import net.sf.openrocket.util.MemoryManagement;
-import net.sf.openrocket.util.Prefs;
 
 public class GUIUtil {
        private static final LogHelper log = Application.getLogger();
@@ -116,7 +115,7 @@ public class GUIUtil {
         * @return    the DPI setting to use.
         */
        public static double getDPI() {
-               int dpi = Prefs.getInt("DPI", 0); // Tenths of a dpi
+               int dpi = Application.getPreferences().getInt("DPI", 0); // Tenths of a dpi
                
                if (dpi < 10) {
                        dpi = Toolkit.getDefaultToolkit().getScreenResolution() * 10;
@@ -128,8 +127,8 @@ public class GUIUtil {
        }
        
        
-
-
+       
+       
        /**
         * Set suitable options for a single-use disposable dialog.  This includes
         * setting ESC to close the dialog, adding the appropriate window icons and
@@ -154,7 +153,7 @@ public class GUIUtil {
        }
        
        
-
+       
        /**
         * Add the correct action to close a JDialog when the ESC key is pressed.
         * The dialog is closed by sending is a WINDOW_CLOSING event.
@@ -193,7 +192,7 @@ public class GUIUtil {
        }
        
        
-
+       
        /**
         * Change the behavior of a component so that TAB and Shift-TAB cycles the focus of
         * the components.  This is necessary for e.g. <code>JTextArea</code>.
@@ -208,7 +207,7 @@ public class GUIUtil {
        }
        
        
-
+       
        /**
         * Set the OpenRocket icons to the window icons.
         * 
@@ -237,7 +236,7 @@ public class GUIUtil {
        }
        
        
-
+       
        /**
         * Set the best available look-and-feel into use.
         */
@@ -295,7 +294,7 @@ public class GUIUtil {
        }
        
        
-
+       
        /**
         * Automatically remember the size of a window.  This stores the window size in the user
         * preferences when resizing/maximizing the window and sets the state on the first call.
@@ -305,22 +304,22 @@ public class GUIUtil {
                        @Override
                        public void componentResized(ComponentEvent e) {
                                log.debug("Storing size of " + window.getClass().getName() + ": " + window.getSize());
-                               Prefs.setWindowSize(window.getClass(), window.getSize());
+                               ((SwingPreferences) Application.getPreferences()).setWindowSize(window.getClass(), window.getSize());
                                if (window instanceof JFrame) {
                                        if ((((JFrame) window).getExtendedState() & JFrame.MAXIMIZED_BOTH) == JFrame.MAXIMIZED_BOTH) {
                                                log.debug("Storing maximized state of " + window.getClass().getName());
-                                               Prefs.setWindowMaximized(window.getClass());
+                                               ((SwingPreferences) Application.getPreferences()).setWindowMaximized(window.getClass());
                                        }
                                }
                        }
                });
                
-               if (Prefs.isWindowMaximized(window.getClass())) {
+               if (((SwingPreferences) Application.getPreferences()).isWindowMaximized(window.getClass())) {
                        if (window instanceof JFrame) {
                                ((JFrame) window).setExtendedState(JFrame.MAXIMIZED_BOTH);
                        }
                } else {
-                       Dimension dim = Prefs.getWindowSize(window.getClass());
+                       Dimension dim = ((SwingPreferences) Application.getPreferences()).getWindowSize(window.getClass());
                        if (dim != null) {
                                window.setSize(dim);
                        }
@@ -336,12 +335,12 @@ public class GUIUtil {
                window.addComponentListener(new ComponentAdapter() {
                        @Override
                        public void componentMoved(ComponentEvent e) {
-                               Prefs.setWindowPosition(window.getClass(), window.getLocation());
+                               ((SwingPreferences) Application.getPreferences()).setWindowPosition(window.getClass(), window.getLocation());
                        }
                });
                
                // Set window position according to preferences, and set prefs when moving
-               Point position = Prefs.getWindowPosition(window.getClass());
+               Point position = ((SwingPreferences) Application.getPreferences()).getWindowPosition(window.getClass());
                if (position != null) {
                        window.setLocationByPlatform(false);
                        window.setLocation(position);
@@ -378,7 +377,7 @@ public class GUIUtil {
        }
        
        
-
+       
        /**
         * Traverses recursively the component tree, and sets all applicable component 
         * models to null, so as to remove the listener connections.  After calling this
@@ -520,7 +519,7 @@ public class GUIUtil {
        }
        
        
-
+       
        /**
         * A mouse listener that toggles the state of a boolean value in a table model
         * when clicked on another column of the table.