This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[gui] [PATCH] FYI: ComponentEvent dispatching fix
- From: David Jee <djee at redhat dot com>
- To: java-patches at gcc dot gnu dot org
- Date: 17 Feb 2004 16:28:33 -0500
- Subject: [gui] [PATCH] FYI: ComponentEvent dispatching fix
- Organization:
Hello,
I committed the following patch to java-gui-branch to fix the
dispatching of ComponentEvents.
-David Jee
2004-02-17 David Jee <djee@redhat.com>
* java/awt/Component.java
(show): Dispatch ComponentEvent via system event queue.
(hide): Likewise.
(move): Likewise.
(resize): Likewise.
(reshape): Likewise.
* java/awt/Window.java
(setBoundsCallback): Likewise.
Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Component.java,v
retrieving revision 1.37.2.2
diff -u -r1.37.2.2 Component.java
--- java/awt/Component.java 16 Feb 2004 22:35:03 -0000 1.37.2.2
+++ java/awt/Component.java 17 Feb 2004 21:19:20 -0000
@@ -882,7 +882,9 @@
if (peer != null)
peer.setVisible(true);
invalidate();
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_SHOWN));
+ ComponentEvent ce =
+ new ComponentEvent(this,ComponentEvent.COMPONENT_SHOWN);
+ getToolkit().getSystemEventQueue().postEvent(ce);
}
}
@@ -913,7 +915,9 @@
peer.setVisible(false);
this.visible = false;
invalidate();
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_HIDDEN));
+ ComponentEvent ce =
+ new ComponentEvent(this,ComponentEvent.COMPONENT_HIDDEN);
+ getToolkit().getSystemEventQueue().postEvent(ce);
}
}
@@ -1177,7 +1181,11 @@
}
if (oldx != x || oldy != y)
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED));
+ {
+ ComponentEvent ce = new ComponentEvent(this,
+ ComponentEvent.COMPONENT_MOVED);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
}
/**
@@ -1262,7 +1270,11 @@
}
if (oldwidth != width || oldheight != height)
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED));
+ {
+ ComponentEvent ce =
+ new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
}
/**
@@ -1377,9 +1389,17 @@
}
if (oldx != x || oldy != y)
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED));
+ {
+ ComponentEvent ce = new ComponentEvent(this,
+ ComponentEvent.COMPONENT_MOVED);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
if (oldwidth != width || oldheight != height)
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED));
+ {
+ ComponentEvent ce = new ComponentEvent(this,
+ ComponentEvent.COMPONENT_RESIZED);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
}
/**
Index: java/awt/Window.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Window.java,v
retrieving revision 1.32.12.1
diff -u -r1.32.12.1 Window.java
--- java/awt/Window.java 16 Feb 2004 22:35:03 -0000 1.32.12.1
+++ java/awt/Window.java 17 Feb 2004 21:19:20 -0000
@@ -792,8 +792,16 @@
width = w;
height = h;
if (resized)
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED));
+ {
+ ComponentEvent ce =
+ new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
if (moved)
- dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED));
+ {
+ ComponentEvent ce =
+ new ComponentEvent(this, ComponentEvent.COMPONENT_MOVED);
+ getToolkit().getSystemEventQueue().postEvent(ce);
+ }
}
}