| public class javax.swing DefaultButtonModel
|
Java SE 6 |
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 JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder.
| version | 1.49 05/25/06 |
| Fields | |
|---|---|
| protected int | stateMask The bitmask used to store the state of the button. |
| protected String | actionCommand The action command string fired by the button. |
| protected ButtonGroup | group The button group that the button belongs to. |
| protected int | mnemonic The button's mnemonic. |
| protected 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".
|
| protected EventListenerList | listenerList Stores the listeners on this model. |
| final public static int | ARMED Identifies the "armed" bit in the bitmask, which indicates partial commitment towards choosing/triggering the button. |
| final public static 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. |
| final public static int | PRESSED Identifies the "pressed" bit in the bitmask, which indicates that the button is pressed. |
| final public static 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). |
| final public static int | ROLLOVER Identifies the "rollover" bit in the bitmask, which indicates that the mouse is over the button. |
| Constructors | |
|---|---|
| public | DefaultButtonModel() Constructs a DefaultButtonModel.
|
| Methods | |||||
|---|---|---|---|---|---|
| public void | addActionListener(ActionListener l) Adds an ActionListener to the model.
| ||||
| public void | addChangeListener(ChangeListener l) Adds a ChangeListener to the model.
| ||||
| public void | addItemListener(ItemListener l) Adds an ItemListener to the model.
| ||||
| protected void | fireActionPerformed(ActionEvent e) Notifies all listeners that have registered interest for notification on this event type.
| ||||
| protected void | fireItemStateChanged(ItemEvent e) Notifies 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. The event instance is created lazily.
| ||||
| public void | removeActionListener(ActionListener l) Removes an ActionListener from the model.
| ||||
| public void | removeChangeListener(ChangeListener l) Removes a ChangeListener from the model.
| ||||
| public void | removeItemListener(ItemListener l) Removes an ItemListener from the model.
| ||||
| Properties | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| public void | setActionCommand(String actionCommand) Sets the action command string that gets sent as part of the ActionEvent when the button is triggered.
| ||||||||||
| public String | getActionCommand() Returns the action command string for the button. | ||||||||||
| public ActionListener[] | getActionListeners() Returns an array of all the action listeners registered on this DefaultButtonModel.
| ||||||||||
| public void | setArmed(boolean b) Marks the button as armed or unarmed. | ||||||||||
| public boolean | isArmed() Indicates partial commitment towards triggering the button. | ||||||||||
| public ChangeListener[] | getChangeListeners() Returns an array of all the change listeners registered on this DefaultButtonModel.
| ||||||||||
| public void | setEnabled(boolean b) Enables or disables the button. | ||||||||||
| public boolean | isEnabled() Indicates if the button can be selected or triggered by an input device, such as a mouse pointer. | ||||||||||
| public void | setGroup(ButtonGroup group) Identifies the group the button belongs to -- needed for radio buttons, which are mutually exclusive within their group. | ||||||||||
| public ButtonGroup | getGroup() Returns the group that the button belongs to. Normally used with radio buttons, which are mutually exclusive within their group.
| ||||||||||
| public ItemListener[] | getItemListeners() Returns an array of all the item listeners registered on this DefaultButtonModel.
| ||||||||||
| public EventListener[]<T> | getListeners(Class listenerType) Returns an array of all the objects currently registered as FooListeners
upon this model.
FooListeners
are registered using the addFooListener method.
You can specify the ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));If no such listeners exist, this method returns an empty array.
| ||||||||||
| public void | setMnemonic(int key) Sets the keyboard mnemonic (shortcut key or accelerator key) for the button. | ||||||||||
| public int | getMnemonic() Gets the keyboard mnemonic for the button. | ||||||||||
| public void | setPressed(boolean b) Sets the button to pressed or unpressed. | ||||||||||
| public boolean | isPressed() Indicates if the button is pressed. | ||||||||||
| public void | setRollover(boolean b) Sets or clears the button's rollover state | ||||||||||
| public boolean | isRollover() Indicates that the mouse is over the button. | ||||||||||
| public void | setSelected(boolean b) Selects or deselects the button. | ||||||||||
| public boolean | isSelected() Indicates if the button has been selected. Only needed for certain types of buttons - such as radio buttons and check boxes. | ||||||||||
| public Object[] | getSelectedObjects() Overridden to return null.
| ||||||||||
| About DocWeb · Bundles · Export · Export All | Top 10 · Statistics · Login |
| About Sun · Contact · Privacy · Terms of Use · Trademarks | Java SE 6 · Copyright © 1994-2009 Sun Microsystems, Inc.All rights reserved. Use is subject to license terms |
![]() |
![]() |
|