src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page

        

*** 541,553 **** @Override public int getState() { return windowState; } @Override public void setMaximizedBounds(Rectangle bounds) { ! // TODO: not implemented } @Override public void setBoundsPrivate(int x, int y, int width, int height) { setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK); --- 541,575 ---- @Override public int getState() { 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) { ! ! bounds = (bounds == null) ! ? getDefaultMaximizedBounds() ! : constrainBounds(bounds); ! platformWindow.setMaximizedBounds( ! bounds.x, bounds.y, bounds.width, bounds.height); } @Override public void setBoundsPrivate(int x, int y, int width, int height) { setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK);
*** 1056,1065 **** --- 1078,1093 ---- @Override public final void displayChanged() { if (updateGraphicsDevice()) { updateMinimumSize(); } + + Rectangle maximizedBounds = getMaximizedBounds(); + if (maximizedBounds == null) { + setMaximizedBounds(getDefaultMaximizedBounds()); + } + // Replace surface unconditionally, because internal state of the // GraphicsDevice could be changed. replaceSurfaceData(); repaintPeer(); }