diff options
author | Robert Schuster <theBohemian@gmx.net> | 2005-07-13 22:47:54 +0000 |
---|---|---|
committer | Robert Schuster <theBohemian@gmx.net> | 2005-07-13 22:47:54 +0000 |
commit | 21ab449df7e458702de8e8c6a96fd912b26faf5c (patch) | |
tree | 8a9c659a08792a2ea7a694107248e3ba5826f6c3 | |
parent | e392e5bb30797374369f7692c1b6ede2ee97cd87 (diff) | |
download | classpath-21ab449df7e458702de8e8c6a96fd912b26faf5c.tar.gz |
2005-07-14 Robert Schuster <robertschuster@fsfe.org>
* javax/swing/AbstractButton.java: Minor doc fixes.
(getActionCommand): Access field directly.
(setActionCommand): Dito.
(fireActionPerformed): Copy ActionEvent instance instead
of reusing it.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | javax/swing/AbstractButton.java | 24 |
2 files changed, 24 insertions, 8 deletions
@@ -1,3 +1,11 @@ +2005-07-14 Robert Schuster <robertschuster@fsfe.org> + + * javax/swing/AbstractButton.java: Minor doc fixes. + (getActionCommand): Access field directly. + (setActionCommand): Dito. + (fireActionPerformed): Copy ActionEvent instance instead + of reusing it. + 2005-07-13 Roman Kennke <roman@kennke.org> * javax/swing/BoundedRangeModel.java: diff --git a/javax/swing/AbstractButton.java b/javax/swing/AbstractButton.java index 6575f939a..abafb164f 100644 --- a/javax/swing/AbstractButton.java +++ b/javax/swing/AbstractButton.java @@ -600,27 +600,27 @@ public abstract class AbstractButton extends JComponent /** * <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 @@ public abstract class AbstractButton extends JComponent */ 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); } /** |