--- old/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java 2015-05-12 15:40:43.000000000 +0400 +++ new/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java 2015-05-12 15:40:43.000000000 +0400 @@ -51,6 +51,8 @@ private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr); private static native Insets nativeGetNSWindowInsets(long nsWindowPtr); private static native void nativeSetNSWindowBounds(long nsWindowPtr, double x, double y, double w, double h); + private static native void nativeSetNSWindowStandardFrame(long nsWindowPtr, + double x, double y, double w, double h); private static native void nativeSetNSWindowMinMax(long nsWindowPtr, double minW, double minH, double maxW, double maxH); private static native void nativePushNSWindowToBack(long nsWindowPtr); private static native void nativePushNSWindowToFront(long nsWindowPtr); @@ -246,6 +248,14 @@ ownerPtr, styleBits, bounds.x, bounds.y, bounds.width, bounds.height); setPtr(nativeWindowPtr); + _peer.setMaximizedBounds(_peer.getMaximizedBounds()); + if (_target instanceof Frame) { + Frame frame = (Frame) _target; + if (frame.getExtendedState() == Frame.MAXIMIZED_BOTH) { + maximize(); + } + } + if (target instanceof javax.swing.RootPaneContainer) { final javax.swing.JRootPane rootpane = ((javax.swing.RootPaneContainer)target).getRootPane(); if (rootpane != null) rootpane.addPropertyChangeListener("ancestor", new PropertyChangeListener() { @@ -474,6 +484,10 @@ nativeSetNSWindowBounds(getNSWindowPtr(), x, y, w, h); } + public void setMaximizedBounds(int x, int y, int w, int h) { + nativeSetNSWindowStandardFrame(getNSWindowPtr(), x, y, w, h); + } + private boolean isMaximized() { return undecorated ? this.normalBounds != null : CWrapper.NSWindow.isZoomed(getNSWindowPtr()); @@ -983,13 +997,11 @@ } private void checkZoom() { - if (target instanceof Frame && isVisible()) { - Frame targetFrame = (Frame)target; - if (targetFrame.getExtendedState() != Frame.MAXIMIZED_BOTH && isMaximized()) { - deliverZoom(true); - } else if (targetFrame.getExtendedState() == Frame.MAXIMIZED_BOTH && !isMaximized()) { - deliverZoom(false); - } + int state = peer.getState(); + if (state != Frame.MAXIMIZED_BOTH && isMaximized()) { + deliverZoom(true); + } else if (state == Frame.MAXIMIZED_BOTH && !isMaximized()) { + deliverZoom(false); } }