I have added a check for isShowing() to each repaint() method and
forward the repaint request to the parent if the component is not
showing. This has been necessary because I have an app here that uses a
Component that overrides the repaint(long, int, int, int, int) method
and misbehaves because it calls repaint() on a Component that is not
currently showing.

2005-08-17  Roman Kennke  <[EMAIL PROTECTED]>

        * java/awt/Component.java
        This applies to various variants of the repaint() methods:
        (repaint): If the component is not showing, forward repaint
        request to the parent.

/Roman

Index: java/awt/Component.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Component.java,v
retrieving revision 1.71
diff -u -r1.71 Component.java
--- java/awt/Component.java	16 Aug 2005 13:39:24 -0000	1.71
+++ java/awt/Component.java	17 Aug 2005 08:53:11 -0000
@@ -1888,7 +1888,14 @@
    */
   public void repaint()
   {
-    repaint(0, 0, 0, width, height);
+    if(!isShowing())
+      {
+        Component p = parent;
+        if (p != null)
+          p.repaint(0, getX(), getY(), width, height);
+      }
+    else
+      repaint(0, 0, 0, width, height);
   }
 
   /**
@@ -1902,7 +1909,14 @@
    */
   public void repaint(long tm)
   {
-    repaint(tm, 0, 0, width, height);
+    if(!isShowing())
+      {
+        Component p = parent;
+        if (p != null)
+          p.repaint(tm, getX(), getY(), width, height);
+      }
+    else
+      repaint(tm, 0, 0, width, height);
   }
 
   /**
@@ -1919,7 +1933,14 @@
    */
   public void repaint(int x, int y, int w, int h)
   {
-    repaint(0, x, y, w, h);
+    if(!isShowing())
+      {
+        Component p = parent;
+        if (p != null)
+          p.repaint(0, x + getX(), y + getY(), width, height);
+      }
+    else
+      repaint(0, x, y, w, h);
   }
 
   /**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to