From 6ce0340a4c6bff2e531e2ee862ca8ccb276d223f Mon Sep 17 00:00:00 2001 From: Robert Schuster Date: Wed, 13 Jul 2005 01:18:42 +0000 Subject: Fixes bug #13691. 2005-07-13 Robert Schuster * 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. --- ChangeLog | 9 +++++++++ javax/swing/AbstractButton.java | 11 ++++++++--- javax/swing/JButton.java | 1 - javax/swing/JToggleButton.java | 1 - 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ffbd124d..cebe8b298 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-07-13 Robert Schuster + + * 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. + 2005-07-13 Robert Schuster * javax/swing/JToggleButton.java: diff --git a/javax/swing/AbstractButton.java b/javax/swing/AbstractButton.java index a8a9df696..6575f939a 100644 --- a/javax/swing/AbstractButton.java +++ b/javax/swing/AbstractButton.java @@ -598,17 +598,22 @@ public abstract class AbstractButton extends JComponent } /** - * Get the action command string for this button's model. + *

Returns the action command string for this button's model.

+ * + *

If the action command string is null, the button's + * text (label) is returned instead.

* * @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. diff --git a/javax/swing/JButton.java b/javax/swing/JButton.java index 83b58f796..7f8f43749 100644 --- a/javax/swing/JButton.java +++ b/javax/swing/JButton.java @@ -79,7 +79,6 @@ public class JButton extends AbstractButton { super(text, icon); setModel(new DefaultButtonModel()); - setActionCommand(text); } public Object[] getSelectedObjects() diff --git a/javax/swing/JToggleButton.java b/javax/swing/JToggleButton.java index f9dbe4c80..e00794be5 100644 --- a/javax/swing/JToggleButton.java +++ b/javax/swing/JToggleButton.java @@ -246,7 +246,6 @@ public class JToggleButton extends AbstractButton implements Accessible setModel(new ToggleButtonModel()); model.setSelected(selected); - model.setActionCommand(""); } /** -- cgit v1.2.1