-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
this fixes the remaining issues with the ActionEvent's actionCommand value.
2005-07-13 Robert Schuster <[EMAIL PROTECTED]>
* javax/swing/AbstractButton.java: Minor doc fixes.
(getActionCommand): Access field directly.
(setActionCommand): Dito.
(fireActionPerformed): Copy ActionEvent instance instead
of reusing it.
cu
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFC1ZgQG9cfwmwwEtoRAnYPAJ46U3a75TgaqaSqJ0vCQrp0yx767QCgi7mt
6iHVEbP2SIqe/mvRmR6gCcc=
=gElx
-----END PGP SIGNATURE-----
Index: javax/swing//AbstractButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.35
diff -u -r1.35 AbstractButton.java
--- javax/swing//AbstractButton.java 13 Jul 2005 01:18:42 -0000 1.35
+++ javax/swing//AbstractButton.java 13 Jul 2005 22:10:00 -0000
@@ -600,27 +600,27 @@
/**
* <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
+ * <p>If the action command was set to <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()
{
- String ac = getModel().getActionCommand();
+ String ac = model.getActionCommand();
- return (ac != null) ? ac : text;
+ return (ac != null ? ac : text);
}
/**
* Sets the action command string for this button's model.
*
- * @param aCommand The new action command string to set in the button's
+ * @param actionCommand The new action command string to set in the button's
* model.
*/
- public void setActionCommand(String aCommand)
+ public void setActionCommand(String actionCommand)
{
- getModel().setActionCommand(aCommand);
+ model.setActionCommand(actionCommand);
}
/**
@@ -749,11 +749,19 @@
*/
protected void fireActionPerformed(ActionEvent e)
{
- e.setSource(this);
+ // Dispatch a copy of the given ActionEvent in order to
+ // set the source and action command correctly.
+ ActionEvent ae = new ActionEvent(
+ this,
+ e.getID(),
+ getActionCommand(),
+ e.getWhen(),
+ e.getModifiers());
+
ActionListener[] listeners = getActionListeners();
for (int i = 0; i < listeners.length; i++)
- listeners[i].actionPerformed(e);
+ listeners[i].actionPerformed(ae);
}
/**
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches