summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2005-11-02 18:03:26 +0000
committerRoman Kennke <roman@kennke.org>2005-11-02 18:03:26 +0000
commit88e2c42c7da20c57684075755f9183ca3ab9a6ae (patch)
tree1f567cc6a20fdf121a594e45f4a69e60d3251999
parent384dd6ab859ae3c5d06f91b188d52a0b3bdfa0e0 (diff)
downloadclasspath-88e2c42c7da20c57684075755f9183ca3ab9a6ae.tar.gz
2005-11-02 Roman Kennke <kennke@aicas.com>
* java/awt/Container.java (addImpl): Notify registered ContainerListeners even when the Container is not showing. Notify the listeners directly, not via the event queue.
-rw-r--r--ChangeLog7
-rw-r--r--java/awt/Container.java25
2 files changed, 21 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 322afafc2..94d38dfa8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2005-11-02 Roman Kennke <kennke@aicas.com>
+ * java/awt/Container.java
+ (addImpl): Notify registered ContainerListeners even when the
+ Container is not showing. Notify the listeners directly, not
+ via the event queue.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
* javax/swing/plaf/basic/BasicLookAndFeel.java
(initComponentDefaults): Fixed the defaults for EditorPane.border,
TextArea.font and TextPane.border.
diff --git a/java/awt/Container.java b/java/awt/Container.java
index 3d31e9cdb..42e5235df 100644
--- a/java/awt/Container.java
+++ b/java/awt/Container.java
@@ -395,17 +395,20 @@ public class Container extends Component
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);
-
- // Repaint this container.
- repaint();
- }
+ // 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(comp.getX(), comp.getY(), comp.getWidth(),
+ comp.getHeight());
}
}