Move getDPI to GUIUtil.
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Mon, 12 Dec 2011 21:24:01 +0000 (21:24 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Mon, 12 Dec 2011 21:24:01 +0000 (21:24 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@218 180e2498-e6e9-4542-8430-84ac67f01cd8

src/net/sf/openrocket/gui/scalefigure/AbstractScaleFigure.java
src/net/sf/openrocket/gui/util/GUIUtil.java
src/net/sf/openrocket/util/Prefs.java

index 02fbac586aae866138f37c015b981e2ad5c70302..e22243de09270d4ea2c9ec62c954e55e4ceac1c7 100644 (file)
@@ -9,7 +9,7 @@ import java.util.List;
 
 import javax.swing.JPanel;
 
-import net.sf.openrocket.util.Prefs;
+import net.sf.openrocket.gui.util.GUIUtil;
 import net.sf.openrocket.util.StateChangeListener;
 
 
@@ -32,7 +32,7 @@ public abstract class AbstractScaleFigure extends JPanel implements ScaleFigure
        
        
        public AbstractScaleFigure() {
-               this.dpi = Prefs.getDPI();
+               this.dpi = GUIUtil.getDPI();
                this.scaling = 1.0;
                this.scale = dpi / 0.0254 * scaling;
                
index 34258d5874f295a0c88b2207dc13a47023230ebf..1123e6520ad4c1ac995acf35546a69a149853577 100644 (file)
@@ -7,6 +7,7 @@ import java.awt.Font;
 import java.awt.Image;
 import java.awt.KeyboardFocusManager;
 import java.awt.Point;
+import java.awt.Toolkit;
 import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -108,7 +109,26 @@ public class GUIUtil {
                }
        }
        
+       /**
+        * Return the DPI setting of the monitor.  This is either the setting provided
+        * by the system or a user-specified DPI setting.
+        * 
+        * @return    the DPI setting to use.
+        */
+       public static double getDPI() {
+               int dpi = Prefs.getInt("DPI", 0); // Tenths of a dpi
+               
+               if (dpi < 10) {
+                       dpi = Toolkit.getDefaultToolkit().getScreenResolution() * 10;
+               }
+               if (dpi < 10)
+                       dpi = 960;
+               
+               return (dpi) / 10.0;
+       }
        
+       
+
 
        /**
         * Set suitable options for a single-use disposable dialog.  This includes
index dfe05a1d4a3f864e75f6ba2f55552a1c9ce76ef8..88822fa79509b2517164486c0f32ccb047603ccb 100644 (file)
@@ -3,7 +3,6 @@ package net.sf.openrocket.util;
 import java.awt.Color;
 import java.awt.Dimension;
 import java.awt.Point;
-import java.awt.Toolkit;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -591,31 +590,14 @@ public class Prefs {
        }
        
        
-       /**
-        * Return the DPI setting of the monitor.  This is either the setting provided
-        * by the system or a user-specified DPI setting.
-        * 
-        * @return    the DPI setting to use.
-        */
-       public static double getDPI() {
-               int dpi = PREFNODE.getInt("DPI", 0); // Tenths of a dpi
-               
-               if (dpi < 10) {
-                       dpi = Toolkit.getDefaultToolkit().getScreenResolution() * 10;
-               }
-               if (dpi < 10)
-                       dpi = 960;
-               
-               return (dpi) / 10.0;
-       }
-       
-       
        public static double getDefaultMach() {
                // TODO: HIGH: implement custom default mach number
                return 0.3;
        }
        
-       
+       public static int getInt( String key, int defaultValue ) {
+               return PREFNODE.getInt(key, defaultValue);
+       }
 
 
        public static Material getDefaultComponentMaterial(