summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--javax/swing/AbstractButton.java24
2 files changed, 24 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 9a84f74ea..2763e11f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
}
/**