Hi,

the Mauve tests I committed recently uncovered two other small issues that are fixed by the attached patch.

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

       * java/awt/Component.java
       (isValid): Always return false when component is
       not showing.
       (setFont): Always set font, even when setting
       the same or equal font again.

/Roman

Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.130
diff -u -1 -2 -r1.130 Component.java
--- java/awt/Component.java	6 Jul 2006 20:42:46 -0000	1.130
+++ java/awt/Component.java	7 Jul 2006 12:13:33 -0000
@@ -737,25 +737,27 @@
   }
 
   /**
    * Tests whether or not this component is valid. A invalid component needs
    * to have its layout redone.
    *
    * @return true if this component is valid
    * @see #validate()
    * @see #invalidate()
    */
   public boolean isValid()
   {
-    return valid;
+    // Tests show that components are invalid as long as they are not showing, even after validate()
+    // has been called on them.
+    return isShowing() && valid;
   }
 
   /**
    * Tests if the component is displayable. It must be connected to a native
    * screen resource.  This reduces to checking that peer is not null.  A 
    * containment  hierarchy is made displayable when a window is packed or 
    * made visible.
    *
    * @return true if the component is displayable
    * @see Container#add(Component)
    * @see Container#remove(Component)
    * @see Window#pack()
@@ -1106,35 +1108,31 @@
   }
 
   /**
    * Sets the font for this component to the specified font. This is a bound
    * property.
    *
    * @param newFont the new font for this component
    * 
    * @see #getFont()
    */
   public void setFont(Font newFont)
   {
-    if((newFont != null && (font == null || !font.equals(newFont)))
-       || newFont == null)
-      {
-        Font oldFont = font;
-        font = newFont;
-        if (peer != null)
-          peer.setFont(font);
-        firePropertyChange("font", oldFont, newFont);
-        if (valid)
-          invalidate();
-      }
+    Font oldFont = font;
+    font = newFont;
+    if (peer != null)
+      peer.setFont(font);
+    firePropertyChange("font", oldFont, newFont);
+    if (valid)
+      invalidate();
   }
 
   /**
    * Tests if the font was explicitly set, or just inherited from the parent.
    *
    * @return true if the font has been set
    * @since 1.4
    */
   public boolean isFontSet()
   {
     return font != null;
   }

Reply via email to