This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui] [PATCH] FIxes in RepaintManager, and others


Hello,

I committed the following patch to the java-gui-branch.  It fixes
java.swing.RepaintManager.addInvalidComponent(), so that it correctly
finds the first isValidateRoot() ancestor, and marks it as invalidate.

The patch also fixes java.awt.GridBagLayout.ArrangeGrid(), so that it
uses the components' preferred sizes, rather than their minimum sizes.

The patch also includes a small reindentation fix in
javax.swing.AbstractButton.

-David Jee

2004-06-30  David Jee  <djee@redhat.com>

        * java/awt/GridBagLayout.java
        (ArrangeGrid): Use PREFERREDSIZE instead of MINSIZE.
        * javax/swing/AbstractButton.java
        (setText): Reindent.
        * javax/swing/RepaintManager.java
        (addInvalidComponent): Find the first ancestor that isValidateRoot().


Index: java/awt/GridBagLayout.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/GridBagLayout.java,v
retrieving revision 1.8.2.3
diff -u -r1.8.2.3 GridBagLayout.java
--- java/awt/GridBagLayout.java	16 Jun 2004 20:52:30 -0000	1.8.2.3
+++ java/awt/GridBagLayout.java	30 Jun 2004 20:53:30 -0000
@@ -340,7 +340,7 @@
       if (components.length == 0)
         return;
 
-      GridBagLayoutInfo info = getLayoutInfo (parent, MINSIZE);
+      GridBagLayoutInfo info = getLayoutInfo (parent, PREFERREDSIZE);
       if (info.cols == 0 && info.rows == 0)
         return;
       layoutInfo = info;
Index: javax/swing/AbstractButton.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/AbstractButton.java,v
retrieving revision 1.5.2.11
diff -u -r1.5.2.11 AbstractButton.java
--- javax/swing/AbstractButton.java	30 Jun 2004 16:33:07 -0000	1.5.2.11
+++ javax/swing/AbstractButton.java	30 Jun 2004 20:53:31 -0000
@@ -1146,9 +1146,9 @@
     if (t != old)
       {
         firePropertyChange(TEXT_CHANGED_PROPERTY, old, t);
-    revalidate();
-    repaint();
-  }
+        revalidate();
+        repaint();
+      }
   }
 
   /**
Index: javax/swing/RepaintManager.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/RepaintManager.java,v
retrieving revision 1.2.18.2
diff -u -r1.2.18.2 RepaintManager.java
--- javax/swing/RepaintManager.java	8 Jun 2004 08:42:54 -0000	1.2.18.2
+++ javax/swing/RepaintManager.java	30 Jun 2004 20:53:31 -0000
@@ -252,11 +252,18 @@
    */
   public synchronized void addInvalidComponent(JComponent component)
   {
-    while ((component.getParent() != null)
-           && (component.getParent() instanceof JComponent)
-           && (component.isValidateRoot()))
-      component = (JComponent) component.getParent();
-    
+    Component ancestor = component.getParent();
+
+    while (ancestor != null
+           && (! (ancestor instanceof JComponent)
+               || ! ((JComponent) ancestor).isValidateRoot() ))
+      ancestor = ancestor.getParent();
+
+    if (ancestor != null
+        && ancestor instanceof JComponent
+        && ((JComponent) ancestor).isValidateRoot())
+      component = (JComponent) ancestor;
+
     if (invalidComponents.contains(component))
       return;
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]