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 applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the java.beans
package.
Please see java.
.
Modifier and Type | Field and Description |
---|---|
protected String | actionCommand
The action command string fired by the button. |
public static final int | ARMED
Identifies the "armed" bit in the bitmask, which indicates partial commitment towards choosing/triggering the button. |
protected transient ChangeEvent | changeEvent
Only one |
public static final int | ENABLED
Identifies the "enabled" bit in the bitmask, which indicates that the button can be selected by an input device (such as a mouse pointer). |
protected ButtonGroup | group
The button group that the button belongs to. |
protected EventListenerList | listenerList
Stores the listeners on this model. |
private boolean | |
protected int | mnemonic
The button's mnemonic. |
public static final int | PRESSED
Identifies the "pressed" bit in the bitmask, which indicates that the button is pressed. |
public static final int | ROLLOVER
Identifies the "rollover" bit in the bitmask, which indicates that the mouse is over the button. |
public static final int | SELECTED
Identifies the "selected" bit in the bitmask, which indicates that the button has been selected. |
protected int | stateMask
The bitmask used to store the state of the button. |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | addActionListener(ActionListener
the listener to add l)Implements javax. ActionListener to the model.
|
public void | addChangeListener(ChangeListener
the listener to add l)Implements javax. ChangeListener to the model.
|
public void | addItemListener(ItemListener
the listener to add l)Implements javax. ItemListener to the model.
|
protected void | fireActionPerformed(ActionEvent
the e)ActionEvent to deliver to listenersNotifies all listeners that have registered interest for notification on this event type. |
protected void | fireItemStateChanged(ItemEvent
the e)ItemEvent to deliver to listenersNotifies all listeners that have registered interest for notification on this event type. |
protected void | fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. |
public String | getActionCommand()
Implements javax. |
public ActionListener[] | Returns: all of this model'sActionListener s
or an empty
array if no action listeners are currently registeredReturns an array of all the action listeners
registered on this |
public ChangeListener[] | Returns: all of this model'sChangeListener s
or an empty
array if no change listeners are currently registeredReturns an array of all the change listeners
registered on this |
public ButtonGroup | Returns: theButtonGroup that the button belongs toOverrides default javax. |
public ItemListener[] | Returns: all of this model'sItemListener s
or an empty
array if no item listeners are currently registeredReturns an array of all the item listeners
registered on this |
public < the type of requested listeners T extends EventListener> T[] | Returns: an array of all objects registered asFooListener s
on this model,
or an empty array if no such
listeners have been addedthe type of listeners requested;
this parameter should specify an interface
that descends from listenerType)java.util.EventListener Returns an array of all the objects currently registered as
|
public int | getMnemonic()
Implements javax. |
public Object[] | getSelectedObjects()
Implements java. null .
|
public boolean | isArmed()
Implements javax. |
public boolean | isEnabled()
Implements javax. |
pack-priv boolean | |
public boolean | |
public boolean | isRollover()
Implements javax. |
public boolean | isSelected()
Implements javax. |
public void | removeActionListener(ActionListener
the listener to remove l)Implements javax. ActionListener from the model.
|
public void | removeChangeListener(ChangeListener
the listener to remove l)Implements javax. ChangeListener from the model.
|
public void | removeItemListener(ItemListener
the listener to remove l)Implements javax. ItemListener from the model.
|
public void | setActionCommand(String
the actionCommand)String that identifies the generated eventImplements javax. ActionEvent when the button is triggered.
|
public void | setArmed(boolean
whether or not the button should be armed b)Implements javax. |
public void | setEnabled(boolean
whether or not the button should be enabled b)Implements javax. |
public void | setGroup(ButtonGroup
the group)ButtonGroup the button belongs toImplements javax. |
pack-priv void | |
public void | setMnemonic(int
an int specifying the accelerator key key)Implements javax. |
public void | setPressed(boolean
whether or not the button should be pressed b)Implements javax. |
public void | setRollover(boolean
whether or not the button is in the rollover state b)Implements javax. |
public void | setSelected(boolean
true selects the button,
false deselects the buttonImplements javax. |
actionCommand | back to summary |
---|---|
protected String actionCommand The action command string fired by the button. |
ARMED | back to summary |
---|---|
public static final int ARMED Identifies the "armed" bit in the bitmask, which indicates partial commitment towards choosing/triggering the button. |
changeEvent | back to summary |
---|---|
protected transient ChangeEvent changeEvent Only one |
ENABLED | back to summary |
---|---|
public static final int ENABLED Identifies the "enabled" bit in the bitmask, which indicates that the button can be selected by an input device (such as a mouse pointer). |
group | back to summary |
---|---|
protected ButtonGroup group The button group that the button belongs to. |
listenerList | back to summary |
---|---|
protected EventListenerList listenerList Stores the listeners on this model. |
menuItem | back to summary |
---|---|
private boolean menuItem |
mnemonic | back to summary |
---|---|
protected int mnemonic The button's mnemonic. |
PRESSED | back to summary |
---|---|
public static final int PRESSED Identifies the "pressed" bit in the bitmask, which indicates that the button is pressed. |
ROLLOVER | back to summary |
---|---|
public static final int ROLLOVER Identifies the "rollover" bit in the bitmask, which indicates that the mouse is over the button. |
SELECTED | back to summary |
---|---|
public static final int SELECTED Identifies the "selected" bit in the bitmask, which indicates that the button has been selected. Only needed for certain types of buttons - such as radio button or check box. |
stateMask | back to summary |
---|---|
protected int stateMask The bitmask used to store the state of the button. |
DefaultButtonModel | back to summary |
---|---|
public DefaultButtonModel() Constructs a |
addActionListener | back to summary |
---|---|
public void addActionListener(ActionListener l) Implements javax. Doc from javax. Adds an
|
addChangeListener | back to summary |
---|---|
public void addChangeListener(ChangeListener l) Implements javax. Doc from javax. Adds a
|
addItemListener | back to summary |
---|---|
public void addItemListener(ItemListener l) Implements javax. Doc from javax. Adds an
|
fireActionPerformed | back to summary |
---|---|
protected void fireActionPerformed(ActionEvent e) Notifies all listeners that have registered interest for notification on this event type.
|
fireItemStateChanged | back to summary |
---|---|
protected void fireItemStateChanged(ItemEvent e) Notifies all listeners that have registered interest for notification on this event type.
|
fireStateChanged | back to summary |
---|---|
protected void fireStateChanged() Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.
|
getActionCommand | back to summary |
---|---|
public String getActionCommand() Implements javax. Doc from javax. Returns the action command string for the button.
|
getActionListeners | back to summary |
---|---|
public ActionListener[] getActionListeners() Returns an array of all the action listeners
registered on this
|
getChangeListeners | back to summary |
---|---|
public ChangeListener[] getChangeListeners() Returns an array of all the change listeners
registered on this
|
getGroup | back to summary |
---|---|
public ButtonGroup getGroup() Overrides default javax. Returns the group that the button belongs to. Normally used with radio buttons, which are mutually exclusive within their group.
|
getItemListeners | back to summary |
---|---|
public ItemListener[] getItemListeners() Returns an array of all the item listeners
registered on this
|
getListeners | back to summary |
---|---|
public <T extends EventListener> T[] getListeners(Class<T> listenerType) Returns an array of all the objects currently registered as
You can specify the ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));If no such listeners exist, this method returns an empty array.
|
getMnemonic | back to summary |
---|---|
public int getMnemonic() Implements javax. Doc from javax. Gets the keyboard mnemonic for the button.
|
getSelectedObjects | back to summary |
---|---|
public Object[] getSelectedObjects() Implements java. Overridden to return
|
isArmed | back to summary |
---|---|
public boolean isArmed() Implements javax. Doc from javax. Indicates partial commitment towards triggering the button.
|
isEnabled | back to summary |
---|---|
public boolean isEnabled() Implements javax. Doc from javax. Indicates if the button can be selected or triggered by an input device, such as a mouse pointer.
|
isMenuItem | back to summary |
---|---|
pack-priv boolean isMenuItem() |
isPressed | back to summary |
---|---|
public boolean isPressed() Implements javax. Doc from javax. Indicates if the button is pressed.
|
isRollover | back to summary |
---|---|
public boolean isRollover() Implements javax. Doc from javax. Indicates that the mouse is over the button.
|
isSelected | back to summary |
---|---|
public boolean isSelected() Implements javax. Doc from javax. Indicates if the button has been selected. Only needed for certain types of buttons - such as radio buttons and check boxes.
|
removeActionListener | back to summary |
---|---|
public void removeActionListener(ActionListener l) Implements javax. Doc from javax. Removes an
|
removeChangeListener | back to summary |
---|---|
public void removeChangeListener(ChangeListener l) Implements javax. Doc from javax. Removes a
|
removeItemListener | back to summary |
---|---|
public void removeItemListener(ItemListener l) Implements javax. Doc from javax. Removes an
|
setActionCommand | back to summary |
---|---|
public void setActionCommand(String actionCommand) Implements javax. Doc from javax. Sets the action command string that gets sent as part of the
|
setArmed | back to summary |
---|---|
public void setArmed(boolean b) Implements javax. Doc from javax. Marks the button as armed or unarmed.
|
setEnabled | back to summary |
---|---|
public void setEnabled(boolean b) Implements javax. Doc from javax. Enables or disables the button.
|
setGroup | back to summary |
---|---|
public void setGroup(ButtonGroup group) Implements javax. Doc from javax. Identifies the group the button belongs to -- needed for radio buttons, which are mutually exclusive within their group.
|
setMenuItem | back to summary |
---|---|
pack-priv void setMenuItem(boolean menuItem) |
setMnemonic | back to summary |
---|---|
public void setMnemonic(int key) Implements javax. Doc from javax. Sets the keyboard mnemonic (shortcut key or accelerator key) for the button.
|
setPressed | back to summary |
---|---|
public void setPressed(boolean b) Implements javax. Doc from javax. Sets the button to pressed or unpressed.
|
setRollover | back to summary |
---|---|
public void setRollover(boolean b) Implements javax. Doc from javax. Sets or clears the button's rollover state
|
setSelected | back to summary |
---|---|
public void setSelected(boolean b) Implements javax. Doc from javax. Selects or deselects the button.
|