We need to validate() in CardLayout.show() to make sure that the components have a good layout. This bug showed up in that AWT/Espresso app that I debug atm.

2006-07-14  Roman Kennke  <[EMAIL PROTECTED]>

        * java/awt/CardLayout.java
        (show): Validate parent to make sure that the layout is
        valid.

/Roman
Index: java/awt/CardLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/CardLayout.java,v
retrieving revision 1.15
diff -u -1 -2 -r1.15 CardLayout.java
--- java/awt/CardLayout.java	21 Feb 2006 15:20:56 -0000	1.15
+++ java/awt/CardLayout.java	14 Jul 2006 12:42:20 -0000
@@ -341,24 +341,25 @@
 	// This is more efficient than calling getComponents().
 	Component[] comps = parent.component;
 	for (int i = 0; i < num; ++i)
 	  {
 	    if (comps[i].isVisible())
 	      {
 		if (target == comps[i])
 		  return;
 		comps[i].setVisible (false);
 	      }
 	  }
 	((Component) target).setVisible (true);
+        parent.validate();
       }
   }
 
   /**
    * Returns a string representation of this layout manager.
    *
    * @return A string representation of this object.
    */
   public String toString ()
   {
     return getClass ().getName () + "[" + hgap + "," + vgap + "]";
   }

Reply via email to