jdk/src/share/classes/java/awt/Container.java
changeset 4257 c447aed67cec
parent 3971 067e6580a577
child 4259 b41995ac0c17
--- a/jdk/src/share/classes/java/awt/Container.java	Wed Oct 14 16:19:46 2009 +0400
+++ b/jdk/src/share/classes/java/awt/Container.java	Wed Oct 14 16:32:38 2009 +0400
@@ -4092,16 +4092,29 @@
         }
     }
 
-    /*
+    /**
+     * Checks if the container and its direct lightweight containers are
+     * visible.
+     *
      * Consider the heavyweight container hides or shows the HW descendants
      * automatically. Therefore we care of LW containers' visibility only.
+     *
+     * This method MUST be invoked under the TreeLock.
      */
-    private boolean isRecursivelyVisibleUpToHeavyweightContainer() {
+    final boolean isRecursivelyVisibleUpToHeavyweightContainer() {
         if (!isLightweight()) {
             return true;
         }
-        return isVisible() && (getContainer() == null ||
-             getContainer().isRecursivelyVisibleUpToHeavyweightContainer());
+
+        for (Container cont = getContainer();
+                cont != null && cont.isLightweight();
+                cont = cont.getContainer())
+        {
+            if (!cont.isVisible()) {
+                return false;
+            }
+        }
+        return true;
     }
 
     @Override