Ticket #16410: WindowGeometry.java.patch

File WindowGeometry.java.patch, 1.5 KB (added by kendzi, 6 years ago)

Fix for throwing IllegalArgumentException when window size is checked

  • src/org/openstreetmap/josm/gui/util/WindowGeometry.java

     
    343343
    344344        // Ensure window does not hide taskbar
    345345
    346         Rectangle maxbounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
     346        try {
     347            Rectangle maxbounds = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    347348
    348         if (!isBugInMaximumWindowBounds(maxbounds)) {
    349             deltax = size.width - maxbounds.width;
    350             if (deltax > 0) {
    351                 size.width -= deltax;
    352             }
     349            if (!isBugInMaximumWindowBounds(maxbounds)) {
     350                deltax = size.width - maxbounds.width;
     351                if (deltax > 0) {
     352                    size.width -= deltax;
     353                }
    353354
    354             deltay = size.height - maxbounds.height;
    355             if (deltay > 0) {
    356                 size.height -= deltay;
     355                deltay = size.height - maxbounds.height;
     356                if (deltay > 0) {
     357                    size.height -= deltay;
     358                }
    357359            }
     360        } catch (IllegalArgumentException e) {
     361            // becaus of bug #16410
     362            Logging.debug(e.toString());
    358363        }
    359364        window.setLocation(p);
    360365        window.setSize(size);