Hey,

This patch fixes a couple of bugs in CardLayout.

The first fix is in maximumLayoutSize.  If the value of the argument
passed is null, then a new Dimension with values of Integer.MAX_VALUE as
its width and height is returned.  I have committed a mauve test for
this modification.

The other fix is in the gotoComponent private method.  In the for-loop,
only the case where the component was already visible was being
considered.  You also need to consider the case where its not visible.
Is this case, you just need to make it visible.  This fix causes a
failing Intel test that was failing to pass.

Cheers,
Tania

2006-10-18  Tania Bento  <[EMAIL PROTECTED]>

        * java/awt/CardLayout.java:
        (maximumLayoutSize): Return a new Dimension with
Integer.MAX_VALUE as
        its height and width if Container passed as argument is null.
        (gotoComponent): Consider the case where the component is not
visible.

Index: java/awt/CardLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/CardLayout.java,v
retrieving revision 1.17
diff -u -r1.17 CardLayout.java
--- java/awt/CardLayout.java	1 Aug 2006 16:10:19 -0000	1.17
+++ java/awt/CardLayout.java	18 Oct 2006 21:42:33 -0000
@@ -225,6 +225,8 @@
    */
   public Dimension maximumLayoutSize (Container target)
   {
+    if (target == null)
+      return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
     // The JCL says that this returns Integer.MAX_VALUE for both
     // dimensions.  But that just seems wrong to me.
     return getSize (target, MAX);
@@ -423,7 +425,10 @@
  
 		if (choice >= 0)
 		  break;
-	      }
+	      } else 
+                {
+                  comps[i].setVisible(true);
+                }
 	  }
 
 	if (choice >= 0 && choice < num)

Reply via email to