classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI: actioncommand fixes


From: Robert Schuster
Subject: [cp-patches] FYI: actioncommand fixes
Date: Wed, 13 Jul 2005 03:20:48 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.8) Gecko/20050514

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,
this fixes the problems with the ActionCommand String for all
AbstractButton subclasses.

The fix proposed in bug #13691 seemed wrong to me after inspecting how
the JDK behaves. I found out that it simply falls back on returning the
buttons label (== text) if the ActionCommand String is null. That's all
and now we do the same.

(Mauve test in preparation.)

2005-07-13  Robert Schuster  <address@hidden>

    * javax/swing/AbstractButton.java: Minimal documentation fixes.
    (getActionCommand): Returns button's label when
    actionCommand is null.
    * javax/swing/JButton.java,
    javax/swing/JToggleButton.java: Removed explicit call to
    setActionCommand in constructors.

cu
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFC1GxwG9cfwmwwEtoRAq95AJ9jMxa9S1lIJ4NeBm9qXNu6PnWbfACfSIVL
DnqyIWtQmD8pAFNSe/RDouU=
=Cae5
-----END PGP SIGNATURE-----
Index: javax/swing//AbstractButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.34
diff -u -r1.34 AbstractButton.java
--- javax/swing//AbstractButton.java    6 Jul 2005 12:20:43 -0000       1.34
+++ javax/swing//AbstractButton.java    13 Jul 2005 01:17:09 -0000
@@ -598,17 +598,22 @@
  }
  
   /**
-   * Get the action command string for this button's model.
+   * <p>Returns the action command string for this button's model.</p>
+   *
+   * <p>If the action command string is <code>null</code>, the button's
+   * text (label) is returned instead.</p>
    *
    * @return The current action command string from the button's model
    */
   public String getActionCommand()
   {
-    return getModel().getActionCommand();
+    String ac = getModel().getActionCommand();
+
+    return (ac != null) ? ac : text;
   }
 
   /**
-   * Set the action command string for this button's model.
+   * Sets the action command string for this button's model.
    *
    * @param aCommand The new action command string to set in the button's
    * model.
Index: javax/swing//JButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JButton.java,v
retrieving revision 1.16
diff -u -r1.16 JButton.java
--- javax/swing//JButton.java   13 Jul 2005 00:34:54 -0000      1.16
+++ javax/swing//JButton.java   13 Jul 2005 01:17:10 -0000
@@ -79,7 +79,6 @@
   {
     super(text, icon);
     setModel(new DefaultButtonModel());
-    setActionCommand(text);
   }
 
   public Object[] getSelectedObjects()
Index: javax/swing//JToggleButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JToggleButton.java,v
retrieving revision 1.20
diff -u -r1.20 JToggleButton.java
--- javax/swing//JToggleButton.java     13 Jul 2005 00:34:54 -0000      1.20
+++ javax/swing//JToggleButton.java     13 Jul 2005 01:17:10 -0000
@@ -246,7 +246,6 @@
 
     setModel(new ToggleButtonModel()); 
     model.setSelected(selected);
-    model.setActionCommand("");
   }
 
   /**

reply via email to

[Prev in Thread] Current Thread [Next in Thread]