src/share/classes/java/awt/Window.java

Print this page

        

@@ -762,11 +762,11 @@
         Dimension newSize = getPreferredSize();
         if (peer != null) {
             setClientSize(newSize.width, newSize.height);
         }
 
-        if(beforeFirstShow) {
+        if (beforeFirstShow) {
             isPacked = true;
         }
 
         validate();
     }

@@ -864,12 +864,17 @@
             }
             if (height < minSize.height) {
                 height = minSize.height;
             }
         }
+        synchronized (getTreeLock()) {
+            if (this.width != width || this.height != height) {
+                isPacked = false;
+            }
         super.reshape(x, y, width, height);
     }
+    }
 
     void setClientSize(int w, int h) {
         synchronized (getTreeLock()) {
             setBoundsOp(ComponentPeer.SET_CLIENT_SIZE);
             setBounds(x, y, w, h);

@@ -1012,11 +1017,14 @@
      * @see #dispose
      * @deprecated As of JDK version 1.5, replaced by
      * {@link #setVisible(boolean)}.
      */
     @Deprecated
+    @Override
     public void hide() {
+        isPacked = false;
+
         synchronized(ownedWindowList) {
             for (int i = 0; i < ownedWindowList.size(); i++) {
                 Window child = ownedWindowList.elementAt(i).get();
                 if ((child != null) && child.visible) {
                     child.hide();

@@ -3795,10 +3803,14 @@
             public Point2D calculateSecurityWarningPosition(Window window,
                     double x, double y, double w, double h)
             {
                 return window.calculateSecurityWarningPosition(x, y, w, h);
             }
+
+            public boolean isPacked(Window window) {
+                return window.isPacked;
+            }
         }); // WindowAccessor
     } // static
 
     // a window doesn't need to be updated in the Z-order.
     @Override