src/share/classes/java/awt/Component.java

Print this page

        

@@ -656,10 +656,18 @@
     private transient Object objectLock = new Object();
     Object getObjectLock() {
         return objectLock;
     }
 
+    /**
+     * Indicates if the window has been packed via pack().
+     *
+     * Note that this field belongs to the Window class, but it cannot be
+     * moved to that class because it is not transient, and therefore must
+     * stay at the Component class for backward-compatibility purposes.
+     * The field SHOULD NOT be used anywhere outside of the Window class.
+     */
     boolean isPacked = false;
 
     /**
      * Pseudoparameter for direct Geometry API (setLocation, setBounds setSize
      * to signal setBounds what's changing. Should be used under TreeLock.

@@ -1554,12 +1562,10 @@
      * @deprecated As of JDK version 1.1,
      * replaced by <code>setVisible(boolean)</code>.
      */
     @Deprecated
     public void hide() {
-        isPacked = false;
-
         if (visible) {
             clearCurrentFocusCycleRootOnHide();
             clearMostRecentFocusOwnerOnHide();
             synchronized (getTreeLock()) {
                 visible = false;

@@ -2112,14 +2118,10 @@
                 this.x = x;
                 this.y = y;
                 this.width = width;
                 this.height = height;
 
-                if (resized) {
-                    isPacked = false;
-                }
-
                 boolean needNotify = true;
                 mixOnReshaping();
                 if (peer != null) {
                     // LightwightPeer is an empty stub so can skip peer.reshape
                     if (!(peer instanceof LightweightPeer)) {