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] Handle MenuComponent in AWTEvent.toString


Hi,

AWTEvent.toString must handle MenuComponents as well as normal
Components.  This patch, which I committed to java-gui-branch, adds
MenuComponent printing to that method.

Tom

2004-06-11  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/AWTEvent.java (toString): Handle MenuComponents in
	addition to Components.

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2660.2.175
diff -u -r1.2660.2.175 ChangeLog
--- ChangeLog	12 Jun 2004 00:21:04 -0000	1.2660.2.175
+++ ChangeLog	12 Jun 2004 00:26:15 -0000
@@ -1,5 +1,8 @@
 2004-06-11  Thomas Fitzsimmons  <fitzsim@redhat.com>
 
+	* java/awt/AWTEvent.java (toString): Handle MenuComponents in
+	addition to Components.
+
 	* java/awt/MenuItem.java (dispatchEventImpl): If the event
 	wasn't consumed by normal processing, send it to the parent
 	menu.
Index: java/awt/AWTEvent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/AWTEvent.java,v
retrieving revision 1.9.46.1
diff -u -r1.9.46.1 AWTEvent.java
--- java/awt/AWTEvent.java	13 May 2004 19:39:58 -0000	1.9.46.1
+++ java/awt/AWTEvent.java	12 Jun 2004 00:26:15 -0000
@@ -238,8 +238,16 @@
    */
   public String toString ()
   {
-    return getClass ().getName () + "[" + paramString () + "] on "
-      + ((Component) source).getName ();
+    String string = null;
+
+    if (source instanceof Component)
+      string = getClass ().getName () + "[" + paramString () + "] on "
+        + ((Component) source).getName ();
+    else if (source instanceof MenuComponent)
+      string = getClass ().getName () + "[" + paramString () + "] on "
+        + ((MenuComponent) source).getName ();
+
+    return string;
   }
 
   /**

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