Hi,

a Mauve test I've already committed shows that Container.addImpl was
behaving wrong with ContainerListener notification. This is fixed.

2005-11-02  Roman Kennke  <[EMAIL PROTECTED]>

        * java/awt/Container.java
        (addImpl): Notify registered ContainerListeners even when the
        Container is not showing. Notify the listeners directly, not
        via the event queue.

/Roman
Index: java/awt/Container.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Container.java,v
retrieving revision 1.65
diff -u -r1.65 Container.java
--- java/awt/Container.java	16 Sep 2005 14:28:17 -0000	1.65
+++ java/awt/Container.java	2 Nov 2005 17:58:27 -0000
@@ -395,17 +395,20 @@
               layoutMgr.addLayoutComponent(null, comp);
           }
 
-        if (isShowing ())
-          {
-            // Post event to notify of adding the component.
-            ContainerEvent ce = new ContainerEvent(this,
-                                                   ContainerEvent.COMPONENT_ADDED,
-                                                   comp);
-            getToolkit().getSystemEventQueue().postEvent(ce);
+        // We previously only sent an event when this container is showing.
+        // Also, the event was posted to the event queue. A Mauve test shows
+        // that this event is not delivered using the event queue and it is
+        // also sent when the container is not showing. 
+        ContainerEvent ce = new ContainerEvent(this,
+                                               ContainerEvent.COMPONENT_ADDED,
+                                               comp);
+        ContainerListener[] listeners = getContainerListeners();
+        for (int i = 0; i < listeners.length; i++)
+          listeners[i].componentAdded(ce);
 
-            // Repaint this container.
-            repaint();
-          }
+        // Repaint this container.
+        repaint(comp.getX(), comp.getY(), comp.getWidth(),
+                comp.getHeight());
       }
   }
 
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to