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

Print this page

        

@@ -170,11 +170,18 @@
         warningWindow = warn;
     }
 
     @Override
     void initializeImpl() {
-        super.initializeImpl();
+        Window target = getTarget();
+        setBackground(target.getBackground());
+        setForeground(target.getForeground());
+        setFont(target.getFont());
+        if (!isMaximized() || getTarget().isVisible()) {
+            setBounds(target.getBounds());
+        }
+        setEnabled(target.isEnabled());
 
 
         if (getTarget() instanceof Frame) {
             setTitle(((Frame) getTarget()).getTitle());
             setState(((Frame) getTarget()).getExtendedState());

@@ -325,10 +332,16 @@
         }
         // Native system could constraint bounds, so the peer wold be updated in the callback
         platformWindow.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height);
     }
 
+    public boolean isMaximized() {
+        Window win = getTarget();
+        return win instanceof Frame
+                && ((Frame) win).getExtendedState() == Frame.MAXIMIZED_BOTH;
+    }
+
     public Rectangle constrainBounds(Rectangle bounds) {
         return constrainBounds(bounds.x, bounds.y, bounds.width, bounds.height);
     }
 
     public Rectangle constrainBounds(int x, int y, int w, int h) {