--- old/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java 2015-05-12 15:40:42.000000000 +0400 +++ new/src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java 2015-05-12 15:40:42.000000000 +0400 @@ -543,9 +543,38 @@ return windowState; } + public Rectangle getMaximizedBounds() { + Object target = getTarget(); + return (target instanceof Frame) + ? ((Frame) target).getMaximizedBounds() : null; + } + + public Rectangle getDefaultMaximizedBounds() { + GraphicsConfiguration config = getGraphicsConfiguration(); + Insets insets = ((CGraphicsDevice) config.getDevice()).getScreenInsets(); + Rectangle toBounds = config.getBounds(); + return new Rectangle( + toBounds.x + insets.left, + toBounds.y + insets.top, + toBounds.width - insets.left - insets.right, + toBounds.height - insets.top - insets.bottom); + } + @Override public void setMaximizedBounds(Rectangle bounds) { - // TODO: not implemented + + bounds = (bounds == null) + ? getDefaultMaximizedBounds() + : constrainBounds(bounds); + platformWindow.setMaximizedBounds( + bounds.x, bounds.y, bounds.width, bounds.height); + } + + private void updateMaximizedBounds() { + Rectangle maximizedBounds = getMaximizedBounds(); + if (maximizedBounds == null) { + setMaximizedBounds(getDefaultMaximizedBounds()); + } } @Override @@ -635,6 +664,10 @@ // Second, update the graphics config and surface data final boolean isNewDevice = updateGraphicsDevice(); + if (isNewDevice) { + updateMaximizedBounds(); + } + if (resized || isNewDevice) { replaceSurfaceData(); updateMinimumSize(); @@ -1058,6 +1091,9 @@ if (updateGraphicsDevice()) { updateMinimumSize(); } + + updateMaximizedBounds(); + // Replace surface unconditionally, because internal state of the // GraphicsDevice could be changed. replaceSurfaceData();