The Demo hangs on the attempt to close third and subsequnt internal frames. The endless loop is a while loop in JComponent.paintChildrenWithOverlap: if the component is not visible, the component index is not advanced forward. The patch replaces the while loop with the for loop that seems more appropriate in this case.

2006-04-30  Audrius Meskauskas  <[EMAIL PROTECTED]>

   PR 27297
   * javax/swing/JComponent.java (paintChildrenWithOverlap):
   Use for and not while to prevent the endless loop.
Index: JComponent.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JComponent.java,v
retrieving revision 1.116
diff -u -r1.116 JComponent.java
--- JComponent.java	26 Apr 2006 12:31:08 -0000	1.116
+++ JComponent.java	30 Apr 2006 09:14:15 -0000
@@ -1862,8 +1862,8 @@
 
     // Go through children from top to bottom and find out their paint
     // rectangles.
-    int index = 0;
-    while (paintRectangles.size() > 0 && index < children.length)
+    for (int index = 0; paintRectangles.size() > 0 &&
+      index < children.length; index++)
       {
         Component comp = children[index];
         if (! comp.isVisible())
@@ -1964,8 +1964,6 @@
             paintRegions.add(componentRectangles);
             componentRectangles = new ArrayList();
           }
-
-        index++;
       }
 
     // paintingTile becomes true just before we start painting the component's

Reply via email to