Class java.awt.swing.DefaultButtonModel
java.lang.Object
|
+----java.awt.swing.DefaultButtonModel
- Subclasses:
- JToggleButton.ToggleButtonModel
- public class DefaultButtonModel
- extends Object
- implements ButtonModel, Serializable
The default implementation of a Button component's
data model.
Warning: serialized objects of this class will not be compatible with
future swing releases. The current serialization support is appropriate
for short term storage or RMI between Swing1.0 applications. It will
not be possible to load serialized Swing1.0 objects with future releases
of Swing. The JDK1.2 release of Swing will be the compatibility
baseline for the serialized form of Swing objects.
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
stateMask
protected int stateMask
actionCommand
protected String actionCommand
group
protected ButtonGroup group
mnemonic
protected int mnemonic
changeEvent
protected transient ChangeEvent changeEvent
- Only one ChangeEvent is needed per button model instance since the
event's only state is the source property. The source of events
generated is always "this".
listenerList
protected EventListenerList listenerList
ARMED
public static final int ARMED
- Indicates if the button can be selected or not by
an input device (such as a mouse pointer).
- See Also:
- setArmed
SELECTED
public static final int SELECTED
- Indicates if the button has been selected. Only needed for
certain types of buttons - such as RadioButton or Checkbox.
PRESSED
public static final int PRESSED
- Indicates partial commitment towards choosing the
button.
ENABLED
public static final int ENABLED
- Indicates whether the button is currently enabled.
ROLLOVER
public static final int ROLLOVER
- Indicates that the mouse is over the button.
DefaultButtonModel
public DefaultButtonModel()
- Constructs a JButtonModel
setActionCommand
public void setActionCommand(String actionCommand)
- Sets the actionCommand that gets sent when the putton is pressed.
- Implements:
- setActionCommand in interface ButtonModel
getActionCommand
public String getActionCommand()
- Returns the action command for this button.
- Implements:
- getActionCommand in interface ButtonModel
isArmed
public boolean isArmed()
- Returns whether the button is "armed".
- Implements:
- isArmed in interface ButtonModel
- Returns:
- true if the button is armed, and it can be selected
- See Also:
- setArmed
isSelected
public boolean isSelected()
- Checks if the button is selected.
- Implements:
- isSelected in interface ButtonModel
isEnabled
public boolean isEnabled()
- Checks if the button is disabled.
- Implements:
- isEnabled in interface ButtonModel
isPressed
public boolean isPressed()
- Checks if the button is pressed.
- Implements:
- isPressed in interface ButtonModel
isRollover
public boolean isRollover()
- Checks if the button is rolled over.
- Implements:
- isRollover in interface ButtonModel
setArmed
public void setArmed(boolean b)
- Identifies the button as "armed".
- Implements:
- setArmed in interface ButtonModel
- Parameters:
b
- true to arm the button so it can be selected
- See Also:
- setArmed
setEnabled
public void setEnabled(boolean b)
- Sets the button to be enabled or disabled state
- Implements:
- setEnabled in interface ButtonModel
setSelected
public void setSelected(boolean b)
- Sets the selected state of the button.
- Implements:
- setSelected in interface ButtonModel
- Parameters:
b
- true selects the toggle button,
false deselects the toggle button.
setPressed
public void setPressed(boolean b)
- Sets the button to pressed state
- Implements:
- setPressed in interface ButtonModel
setRollover
public void setRollover(boolean b)
- Sets the button to the rollover state
- Implements:
- setRollover in interface ButtonModel
setMnemonic
public void setMnemonic(int key)
- Sets the keyboard mnemonic for this model
- Implements:
- setMnemonic in interface ButtonModel
getMnemonic
public int getMnemonic()
- Gets the keyboard mnemonic for this model
- Implements:
- getMnemonic in interface ButtonModel
addChangeListener
public void addChangeListener(ChangeListener l)
- Adds a ChangeListener to the button.
- Implements:
- addChangeListener in interface ButtonModel
removeChangeListener
public void removeChangeListener(ChangeListener l)
- Removes a ChangeListener from the button.
- Implements:
- removeChangeListener in interface ButtonModel
fireStateChanged
protected void fireStateChanged()
addActionListener
public void addActionListener(ActionListener l)
- adds an ActionListener to the button
- Implements:
- addActionListener in interface ButtonModel
removeActionListener
public void removeActionListener(ActionListener l)
- removes an ActionListener from the button
- Implements:
- removeActionListener in interface ButtonModel
fireActionPerformed
protected void fireActionPerformed(ActionEvent e)
addItemListener
public void addItemListener(ItemListener l)
- adds an ItemListener to the button
- Implements:
- addItemListener in interface ButtonModel
removeItemListener
public void removeItemListener(ItemListener l)
- removes an ItemListener from the button
- Implements:
- removeItemListener in interface ButtonModel
fireItemStateChanged
protected void fireItemStateChanged(ItemEvent e)
getSelectedObjects
public Object[] getSelectedObjects()
setGroup
public void setGroup(ButtonGroup group)
- Implements:
- setGroup in interface ButtonModel
Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.