Changeset 10115 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-04-07T00:02:22+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r9576 r10115 49 49 */ 50 50 public static WindowGeometry centerOnScreen(Dimension extent, String preferenceKey) { 51 Rectangle size = preferenceKey != null ? getScreenInfo(preferenceKey) 52 : getFullScreenInfo(); 51 Rectangle size = preferenceKey != null ? getScreenInfo(preferenceKey) : getFullScreenInfo(); 53 52 Point topLeft = new Point( 54 53 size.x + Math.max(0, (size.width - extent.width) /2), … … 117 116 */ 118 117 public WindowGeometry(Rectangle rect) { 119 this.topLeft = rect.getLocation(); 120 this.extent = rect.getSize(); 118 this(rect.getLocation(), rect.getSize()); 121 119 } 122 120 … … 426 424 */ 427 425 private static Rectangle getScreenInfo(Rectangle g) { 428 GraphicsEnvironment ge = GraphicsEnvironment 429 .getLocalGraphicsEnvironment(); 430 GraphicsDevice[] gs = ge.getScreenDevices(); 426 GraphicsDevice[] gs = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); 431 427 int intersect = 0; 432 428 Rectangle bounds = null; … … 446 442 is = b.intersection(g); 447 443 s = is.width * is.height; 448 if ( bounds == null ||intersect < s) {444 if (intersect < s) { 449 445 intersect = s; 450 446 bounds = b; … … 460 456 } 461 457 } 462 return bounds ;458 return bounds != null ? bounds : g; 463 459 } 464 460
Note: See TracChangeset
for help on using the changeset viewer.