javax.swing
public class DefaultButtonModel extends Object implements ButtonModel, Serializable
| Field Summary | |
|---|---|
| static int | ARMED
Indicates that the button is partially committed to being
pressed, but not entirely. |
| protected String | actionCommand
The string used as the "command" property of any ActionEvent this model
sends. |
| protected ChangeEvent | changeEvent The single ChangeEvent this model (re)uses to call its ChangeListeners. |
| static int | ENABLED
State constant indicating that the button is enabled. |
| protected ButtonGroup | group
The group this model belongs to. |
| protected EventListenerList | listenerList
List of ItemListeners, ChangeListeners, and ActionListeners registered on
this model. |
| protected int | mnemonic
The key code (one of {@link java.awt.event.KeyEvent} VK_) used to press
this button via a keyboard interface. |
| static int | PRESSED
State constant indicating that the user is holding down the button. |
| static int | ROLLOVER
State constant indicating that the mouse is currently positioned over the
button. |
| protected int | stateMask
Represents the "state properties" (armed, enabled, pressed, rollover and
selected) by a bitwise combination of integer constants. |
| static int | SELECTED
State constant indicating that the button is selected. |
| Constructor Summary | |
|---|---|
| DefaultButtonModel()
Creates a new DefaultButtonModel object. | |
| Method Summary | |
|---|---|
| void | addActionListener(ActionListener l)
Add an ActionListener to the model. |
| void | addChangeListener(ChangeListener l)
Add a ChangeListener to the model. |
| void | addItemListener(ItemListener l)
Add an ItemListener to the model. |
| protected void | fireActionPerformed(ActionEvent e)
Inform each ActionListener in the {@link #listenerList} that an
ActionEvent has occurred. |
| protected void | fireItemStateChanged(ItemEvent e)
Inform each ItemListener in the {@link #listenerList} that an ItemEvent
has occurred. |
| protected void | fireStateChanged()
Inform each ChangeListener in the {@link #listenerList} that a ChangeEvent
has occurred. |
| String | getActionCommand()
Returns the current value of the model's "actionCommand" property.
|
| ActionListener[] | getActionListeners()
Returns all registered ActionListener objects.
|
| ChangeListener[] | getChangeListeners()
Returns all registered ChangeListener objects.
|
| ButtonGroup | getGroup()
Returns the current value of the model's "group" property.
|
| ItemListener[] | getItemListeners()
Returns all registered ItemListener objects.
|
| <T extends EventListener> T[] | getListeners(Class<T> listenerType)
Returns a specified class of listeners.
|
| int | getMnemonic()
Get the value of the model's "mnemonic" property.
|
| Object[] | getSelectedObjects()
Return null. |
| boolean | isArmed()
Get the value of the model's "armed" property.
|
| boolean | isEnabled()
Get the value of the model's "enabled" property.
|
| boolean | isPressed()
Get the value of the model's "pressed" property.
|
| boolean | isRollover()
Get the value of the model's "rollover" property.
|
| boolean | isSelected()
Get the value of the model's "selected" property.
|
| void | removeActionListener(ActionListener l)
Remove an ActionListener to the model. |
| void | removeChangeListener(ChangeListener l)
Remove a ChangeListener to the model. |
| void | removeItemListener(ItemListener l)
Remove an ItemListener to the model. |
| void | setActionCommand(String s)
Set the value of the model's "actionCommand" property. |
| void | setArmed(boolean a)
Set the value of the model's "armed" property.
|
| void | setEnabled(boolean e)
Set the value of the model's "enabled" property.
|
| void | setGroup(ButtonGroup g)
Set the value of the model's "group" property. |
| void | setMnemonic(int key)
Set the value of the model's "mnemonic" property.
|
| void | setPressed(boolean p)
Set the value of the model's "pressed" property.
|
| void | setRollover(boolean r)
Set the value of the model's "rollover" property.
|
| void | setSelected(boolean s)
Set the value of the model's "selected" property.
|
Parameters: l The listener to add
Parameters: l The listener to add
Parameters: l The listener to add
true.
Parameters: e The ActionEvent to fire
Parameters: e The ItemEvent to fire
Returns: The current "actionCommand" property
ActionListener objects.
Returns: array of ActionListener objects
ChangeListener objects.
Returns: array of ChangeListener objects
Returns: The value of the "group" property
See Also: setGroup
ItemListener objects.
Returns: array of ItemListener objects
Parameters: listenerType the type of listener to return
Returns: array of listeners
Returns: The current "mnemonic" property
null. Use {@link AbstractButton} if you wish to
interface with a button via an {@link ItemSelectable} interface.
Returns: null
Returns: The current "armed" property
Returns: The current "enabled" property.
Returns: The current "pressed" property
Returns: The current "rollover" property
Returns: The current "selected" property
Parameters: l The listener to remove
Parameters: l The listener to remove
Parameters: l The listener to remove
Parameters: s The new "actionCommand" property.
Parameters: a The new "armed" property
Parameters: e The new "enabled" property
true at a time.
Parameters: g The new "group" property (null permitted).
See Also: getGroup
Parameters: key The new "mnemonic" property
Parameters: p The new "pressed" property
Parameters: r The new "rollover" property
Parameters: s The new "selected" property