Changeset 10409 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2016-06-17T02:58:36+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r10405 r10409 141 141 // The only events that may move/resize this map view are window movements or changes to the map view size. 142 142 // We can clean this up more by only recalculating the state on repaint. 143 private final HierarchyListener hierarchyListener = new HierarchyListener() {143 private final transient HierarchyListener hierarchyListener = new HierarchyListener() { 144 144 @Override 145 145 public void hierarchyChanged(HierarchyEvent e) { … … 151 151 }; 152 152 153 private final ComponentAdapter componentListener = new ComponentAdapter() {153 private final transient ComponentAdapter componentListener = new ComponentAdapter() { 154 154 @Override 155 155 public void componentShown(ComponentEvent e) { … … 170 170 * The current state (scale, center, ...) of this map view. 171 171 */ 172 private MapViewState state;172 private transient MapViewState state; 173 173 174 174 /** -
trunk/src/org/openstreetmap/josm/gui/util/GuiSizesHelper.java
r10392 r10409 3 3 4 4 import java.awt.Dimension; 5 import java.awt. HeadlessException;5 import java.awt.GraphicsEnvironment; 6 6 import java.awt.Toolkit; 7 7 … … 20 20 } 21 21 22 23 22 /** cache value for screen resolution */ 24 23 private static float screenDPI = -1; 25 24 26 /** Request the screen resolution (cached) 25 /** 26 * Request the screen resolution (cached) 27 27 * @return screen resolution in DPI 28 28 */ … … 35 35 screenDPI = 96f * scalePref; 36 36 } else { 37 try{37 if (!GraphicsEnvironment.isHeadless()) { 38 38 screenDPI = Toolkit.getDefaultToolkit().getScreenResolution(); 39 } catch (HeadlessException e){39 } else { 40 40 screenDPI = 96; 41 41 } … … 53 53 */ 54 54 public static float getPixelDensity() { 55 float pixelPerInch = getScreenDPI(); 56 return pixelPerInch / 96f; 55 return getScreenDPI() / 96f; 57 56 } 58 57 … … 72 71 public static int getSizeDpiAdjusted(int size) { 73 72 if (size <= 0) return size; 74 float pixelPerInch = getScreenDPI(); 75 return Math.round(size * pixelPerInch / 96); 73 return Math.round(size * getScreenDPI() / 96); 76 74 } 77 75 … … 83 81 public static float getSizeDpiAdjusted(float size) { 84 82 if (size <= 0f) return size; 85 float pixelPerInch = getScreenDPI(); 86 return size * pixelPerInch / 96; 83 return size * getScreenDPI() / 96; 87 84 } 88 85 … … 94 91 public static double getSizeDpiAdjusted(double size) { 95 92 if (size <= 0d) return size; 96 float pixelPerInch = getScreenDPI(); 97 return size * pixelPerInch / 96; 93 return size * getScreenDPI() / 96; 98 94 } 99 95 … … 105 101 public static Dimension getDimensionDpiAdjusted(Dimension dim) { 106 102 float pixelPerInch = getScreenDPI(); 107 int width = dim.width, height = dim.height; 103 int width = dim.width; 104 int height = dim.height; 108 105 if (dim.width > 0) { 109 106 width = Math.round(dim.width * pixelPerInch / 96);
Note:
See TracChangeset
for help on using the changeset viewer.