In Component and Container we should only invalidate() when the component is actually valid. An AWT based app here seems to expect that behaviour.

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

       * java/awt/Component.java
       (setFont): Only invalidate when component is valid.
       * java/awt/Container.java
       (setLayout): Only invalidate when component is valid.

/Roman

Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.129
diff -u -1 -2 -r1.129 Component.java
--- java/awt/Component.java	6 Jul 2006 17:32:52 -0000	1.129
+++ java/awt/Component.java	6 Jul 2006 20:39:45 -0000
@@ -1114,25 +1114,26 @@
    * @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);
-        invalidate();
+        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;
Index: java/awt/Container.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.96
diff -u -1 -2 -r1.96 Container.java
--- java/awt/Container.java	6 Jul 2006 17:32:52 -0000	1.96
+++ java/awt/Container.java	6 Jul 2006 20:39:45 -0000
@@ -508,25 +508,26 @@
     return layoutMgr;
   }
 
   /**
    * Sets the layout manager for this container to the specified layout
    * manager.
    *
    * @param mgr The new layout manager for this container.
    */
   public void setLayout(LayoutManager mgr)
   {
     layoutMgr = mgr;
-    invalidate();
+    if (valid)
+      invalidate();
   }
 
   /**
    * Layout the components in this container.
    */
   public void doLayout()
   {
     layout ();
   }
 
   /**
    * Layout the components in this container.

Reply via email to