[gui][PATCH] Fixes to AbstractButton

Olga Rodimina rodimina@redhat.com
Sun Jun 20 04:16:00 GMT 2004


Hi,

This patch makes few fixes to AbstractButton and removes unnecessary
print out statements from BasicMenuBarUI.

I'll be committing this patch to java-gui-branch.


Olga.
-------------- next part --------------
? .snprj
? libjava.proj
? patch
? popup_Patch
? resources
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2660.2.207
diff -c -p -u -r1.2660.2.207 ChangeLog
--- ChangeLog	18 Jun 2004 16:33:21 -0000	1.2660.2.207
+++ ChangeLog	18 Jun 2004 20:42:54 -0000
@@ -1,3 +1,18 @@
+2004-06-18  Rodimina Olga  <rodimina@redhat.com>
+
+	* javax/swing/AbstractButton.java
+	(changeEvent): New field.
+	(fireItemStateChanged): Change source of the event
+	to 'this' before firing it to button listeners.
+	(fireActionPerformed): Likewise.
+	(fireStateChanged): Likewise.
+	(createActionListener): Do not set source 
+	of the event to AbstractButton.                                  
+	* javax/swing/plaf/basic/BasicMenuBarUI.java:
+	(ContainerHandler.componentAdded): Removed 
+	print out statement.
+	(ContainerHandler.componentRemoved): Likewise.
+
 2004-06-18  David Jee  <djee@redhat.com>
 
 	* gnu/java/awt/image/ImageDecoder.java
Index: javax/swing/AbstractButton.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/AbstractButton.java,v
retrieving revision 1.5.2.7
diff -c -p -u -r1.5.2.7 AbstractButton.java
--- javax/swing/AbstractButton.java	9 Jun 2004 22:46:47 -0000	1.5.2.7
+++ javax/swing/AbstractButton.java	18 Jun 2004 20:42:55 -0000
@@ -230,6 +230,9 @@ public abstract class AbstractButton ext
       Action. */
   PropertyChangeListener actionPropertyChangeListener;
   
+  /** ChangeEvent that is fired to button's ChangeEventListeners  */  
+  private ChangeEvent changeEvent = new ChangeEvent(this);
+  
   /** Fired in a PropertyChangeEvent when the "borderPainted" property changes. */
   public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
   
@@ -642,6 +645,7 @@ public abstract class AbstractButton ext
    */
   public void fireItemStateChanged(ItemEvent e)
   {
+    e.setSource(this);
     EventListener[] ll = listenerList.getListeners(ItemListener.class);
     for (int i = 0; i < ll.length; i++)
       ((ItemListener)ll[i]).itemStateChanged(e);
@@ -655,6 +659,7 @@ public abstract class AbstractButton ext
    */
   public void fireActionPerformed(ActionEvent e)
   {
+    e.setSource(this);
     EventListener[] ll = listenerList.getListeners(ActionListener.class);
     for (int i = 0; i < ll.length; i++)
       ((ActionListener)ll[i]).actionPerformed(e);
@@ -671,7 +676,7 @@ public abstract class AbstractButton ext
   {
     EventListener[] ll = listenerList.getListeners(ChangeListener.class);
     for (int i = 0; i < ll.length; i++)
-      ((ChangeListener)ll[i]).stateChanged(e);
+      ((ChangeListener)ll[i]).stateChanged(changeEvent);
   }
 
   /**
@@ -1416,7 +1421,6 @@ public abstract class AbstractButton ext
       {
         public void actionPerformed(ActionEvent e)
         {
-          e.setSource(AbstractButton.this);
           AbstractButton.this.fireActionPerformed(e);
         }
       };
Index: javax/swing/plaf/basic/BasicMenuBarUI.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/plaf/basic/BasicMenuBarUI.java,v
retrieving revision 1.1.2.3
diff -c -p -u -r1.1.2.3 BasicMenuBarUI.java
--- javax/swing/plaf/basic/BasicMenuBarUI.java	14 Jun 2004 14:16:59 -0000	1.1.2.3
+++ javax/swing/plaf/basic/BasicMenuBarUI.java	18 Jun 2004 20:42:55 -0000
@@ -284,7 +284,6 @@ public class BasicMenuBarUI extends Menu
      */
     public void componentAdded(ContainerEvent e)
     {
-      System.out.println("BasicMenuBar...componentAdded.. listener");
     }
 
     /**
@@ -294,7 +293,6 @@ public class BasicMenuBarUI extends Menu
      */
     public void componentRemoved(ContainerEvent e)
     {
-      System.out.println("BasicMenuBar...componentRemoved.. listener");
     }
   }
 


More information about the Java-patches mailing list