javax.swing
Class DefaultButtonModel

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.swing.DefaultButtonModel
All Implemented Interfaces:
ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable , Serializable sample code for java.io.Serializable definition code for java.io.Serializable , ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Direct Known Subclasses:
JToggleButton.ToggleButtonModel sample code for javax.swing.JToggleButton.ToggleButtonModel definition code for javax.swing.JToggleButton.ToggleButtonModel

public class DefaultButtonModel
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel , Serializable sample code for java.io.Serializable definition code for java.io.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 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 XMLEncoder sample code for java.beans.XMLEncoder definition code for java.beans.XMLEncoder .

See Also:
Serialized Form

Field Summary
protected  String sample code for java.lang.String definition code for java.lang.String actionCommand sample code for javax.swing.DefaultButtonModel.actionCommand definition code for javax.swing.DefaultButtonModel.actionCommand
           
static int ARMED sample code for javax.swing.DefaultButtonModel.ARMED definition code for javax.swing.DefaultButtonModel.ARMED
          Indicates partial commitment towards choosing the button.
protected  ChangeEvent sample code for javax.swing.event.ChangeEvent definition code for javax.swing.event.ChangeEvent changeEvent sample code for javax.swing.DefaultButtonModel.changeEvent definition code for javax.swing.DefaultButtonModel.changeEvent
          Only one ChangeEvent is needed per button model instance since the event's only state is the source property.
static int ENABLED sample code for javax.swing.DefaultButtonModel.ENABLED definition code for javax.swing.DefaultButtonModel.ENABLED
          Indicates that the button can be selected by an input device (such as a mouse pointer).
protected  ButtonGroup sample code for javax.swing.ButtonGroup definition code for javax.swing.ButtonGroup group sample code for javax.swing.DefaultButtonModel.group definition code for javax.swing.DefaultButtonModel.group
           
protected  EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList listenerList sample code for javax.swing.DefaultButtonModel.listenerList definition code for javax.swing.DefaultButtonModel.listenerList
           
protected  int mnemonic sample code for javax.swing.DefaultButtonModel.mnemonic definition code for javax.swing.DefaultButtonModel.mnemonic
           
static int PRESSED sample code for javax.swing.DefaultButtonModel.PRESSED definition code for javax.swing.DefaultButtonModel.PRESSED
          Indicates that the button has been "pressed" (typically, when the mouse is released).
static int ROLLOVER sample code for javax.swing.DefaultButtonModel.ROLLOVER definition code for javax.swing.DefaultButtonModel.ROLLOVER
          Indicates that the mouse is over the button.
static int SELECTED sample code for javax.swing.DefaultButtonModel.SELECTED definition code for javax.swing.DefaultButtonModel.SELECTED
          Indicates that the button has been selected.
protected  int stateMask sample code for javax.swing.DefaultButtonModel.stateMask definition code for javax.swing.DefaultButtonModel.stateMask
           
 
Constructor Summary
DefaultButtonModel sample code for javax.swing.DefaultButtonModel.DefaultButtonModel() definition code for javax.swing.DefaultButtonModel.DefaultButtonModel() ()
          Constructs a default JButtonModel.
 
Method Summary
 void addActionListener sample code for javax.swing.DefaultButtonModel.addActionListener(java.awt.event.ActionListener) definition code for javax.swing.DefaultButtonModel.addActionListener(java.awt.event.ActionListener) (ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
          Adds an ActionListener to the button.
 void addChangeListener sample code for javax.swing.DefaultButtonModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.DefaultButtonModel.addChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Adds a ChangeListener to the button.
 void addItemListener sample code for javax.swing.DefaultButtonModel.addItemListener(java.awt.event.ItemListener) definition code for javax.swing.DefaultButtonModel.addItemListener(java.awt.event.ItemListener) (ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
          Adds an ItemListener to the button.
protected  void fireActionPerformed sample code for javax.swing.DefaultButtonModel.fireActionPerformed(java.awt.event.ActionEvent) definition code for javax.swing.DefaultButtonModel.fireActionPerformed(java.awt.event.ActionEvent) (ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent  e)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireItemStateChanged sample code for javax.swing.DefaultButtonModel.fireItemStateChanged(java.awt.event.ItemEvent) definition code for javax.swing.DefaultButtonModel.fireItemStateChanged(java.awt.event.ItemEvent) (ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent  e)
          Notifies all listeners that have registered interest for notification on this event type.
protected  void fireStateChanged sample code for javax.swing.DefaultButtonModel.fireStateChanged() definition code for javax.swing.DefaultButtonModel.fireStateChanged() ()
          Notifies all listeners that have registered interest for notification on this event type.
 String sample code for java.lang.String definition code for java.lang.String getActionCommand sample code for javax.swing.DefaultButtonModel.getActionCommand() definition code for javax.swing.DefaultButtonModel.getActionCommand() ()
          Returns the action command for this button.
 ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener [] getActionListeners sample code for javax.swing.DefaultButtonModel.getActionListeners() definition code for javax.swing.DefaultButtonModel.getActionListeners() ()
          Returns an array of all the action listeners registered on this DefaultButtonModel.
 ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners sample code for javax.swing.DefaultButtonModel.getChangeListeners() definition code for javax.swing.DefaultButtonModel.getChangeListeners() ()
          Returns an array of all the change listeners registered on this DefaultButtonModel.
 ButtonGroup sample code for javax.swing.ButtonGroup definition code for javax.swing.ButtonGroup getGroup sample code for javax.swing.DefaultButtonModel.getGroup() definition code for javax.swing.DefaultButtonModel.getGroup() ()
          Returns the group that this button belongs to.
 ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener [] getItemListeners sample code for javax.swing.DefaultButtonModel.getItemListeners() definition code for javax.swing.DefaultButtonModel.getItemListeners() ()
          Returns an array of all the item listeners registered on this DefaultButtonModel.
<T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener >
T[]
getListeners sample code for javax.swing.DefaultButtonModel.getListeners(java.lang.Class) definition code for javax.swing.DefaultButtonModel.getListeners(java.lang.Class) (Class sample code for java.lang.Class definition code for java.lang.Class <T> listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this model.
 int getMnemonic sample code for javax.swing.DefaultButtonModel.getMnemonic() definition code for javax.swing.DefaultButtonModel.getMnemonic() ()
          Gets the keyboard mnemonic for this model
 Object sample code for java.lang.Object definition code for java.lang.Object [] getSelectedObjects sample code for javax.swing.DefaultButtonModel.getSelectedObjects() definition code for javax.swing.DefaultButtonModel.getSelectedObjects() ()
          Overridden to return null.
 boolean isArmed sample code for javax.swing.DefaultButtonModel.isArmed() definition code for javax.swing.DefaultButtonModel.isArmed() ()
          Indicates partial commitment towards pressing the button.
 boolean isEnabled sample code for javax.swing.DefaultButtonModel.isEnabled() definition code for javax.swing.DefaultButtonModel.isEnabled() ()
          Indicates whether the button can be selected or pressed by an input device (such as a mouse pointer).
 boolean isPressed sample code for javax.swing.DefaultButtonModel.isPressed() definition code for javax.swing.DefaultButtonModel.isPressed() ()
          Indicates whether button has been pressed.
 boolean isRollover sample code for javax.swing.DefaultButtonModel.isRollover() definition code for javax.swing.DefaultButtonModel.isRollover() ()
          Indicates that the mouse is over the button.
 boolean isSelected sample code for javax.swing.DefaultButtonModel.isSelected() definition code for javax.swing.DefaultButtonModel.isSelected() ()
          Indicates if the button has been selected.
 void removeActionListener sample code for javax.swing.DefaultButtonModel.removeActionListener(java.awt.event.ActionListener) definition code for javax.swing.DefaultButtonModel.removeActionListener(java.awt.event.ActionListener) (ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
          Removes an ActionListener from the button.
 void removeChangeListener sample code for javax.swing.DefaultButtonModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.DefaultButtonModel.removeChangeListener(javax.swing.event.ChangeListener) (ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
          Removes a ChangeListener from the button.
 void removeItemListener sample code for javax.swing.DefaultButtonModel.removeItemListener(java.awt.event.ItemListener) definition code for javax.swing.DefaultButtonModel.removeItemListener(java.awt.event.ItemListener) (ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
          Removes an ItemListener from the button.
 void setActionCommand sample code for javax.swing.DefaultButtonModel.setActionCommand(java.lang.String) definition code for javax.swing.DefaultButtonModel.setActionCommand(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  actionCommand)
          Sets the actionCommand string that gets sent as part of the event when the button is pressed.
 void setArmed sample code for javax.swing.DefaultButtonModel.setArmed(boolean) definition code for javax.swing.DefaultButtonModel.setArmed(boolean) (boolean b)
          Marks the button as "armed".
 void setEnabled sample code for javax.swing.DefaultButtonModel.setEnabled(boolean) definition code for javax.swing.DefaultButtonModel.setEnabled(boolean) (boolean b)
          Enables or disables the button.
 void setGroup sample code for javax.swing.DefaultButtonModel.setGroup(javax.swing.ButtonGroup) definition code for javax.swing.DefaultButtonModel.setGroup(javax.swing.ButtonGroup) (ButtonGroup sample code for javax.swing.ButtonGroup definition code for javax.swing.ButtonGroup  group)
          Identifies the group this button belongs to -- needed for radio buttons, which are mutually exclusive within their group.
 void setMnemonic sample code for javax.swing.DefaultButtonModel.setMnemonic(int) definition code for javax.swing.DefaultButtonModel.setMnemonic(int) (int key)
          Sets the keyboard mnemonic (shortcut key or accelerator key) for this button.
 void setPressed sample code for javax.swing.DefaultButtonModel.setPressed(boolean) definition code for javax.swing.DefaultButtonModel.setPressed(boolean) (boolean b)
          Sets the button to pressed or unpressed.
 void setRollover sample code for javax.swing.DefaultButtonModel.setRollover(boolean) definition code for javax.swing.DefaultButtonModel.setRollover(boolean) (boolean b)
          Sets or clears the button's rollover state
 void setSelected sample code for javax.swing.DefaultButtonModel.setSelected(boolean) definition code for javax.swing.DefaultButtonModel.setSelected(boolean) (boolean b)
          Selects or deselects the button.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

stateMask sample code for javax.swing.DefaultButtonModel.stateMask

protected int stateMask

actionCommand sample code for javax.swing.DefaultButtonModel.actionCommand

protected String sample code for java.lang.String definition code for java.lang.String  actionCommand

group sample code for javax.swing.DefaultButtonModel.group

protected ButtonGroup sample code for javax.swing.ButtonGroup definition code for javax.swing.ButtonGroup  group

mnemonic sample code for javax.swing.DefaultButtonModel.mnemonic

protected int mnemonic

changeEvent sample code for javax.swing.DefaultButtonModel.changeEvent

protected transient ChangeEvent sample code for javax.swing.event.ChangeEvent definition code for javax.swing.event.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 sample code for javax.swing.DefaultButtonModel.listenerList

protected EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList  listenerList

ARMED sample code for javax.swing.DefaultButtonModel.ARMED

public static final int ARMED
Indicates partial commitment towards choosing the button.

See Also:
Constant Field Values

SELECTED sample code for javax.swing.DefaultButtonModel.SELECTED

public static final int SELECTED
Indicates that the button has been selected. Only needed for certain types of buttons - such as RadioButton or Checkbox.

See Also:
Constant Field Values

PRESSED sample code for javax.swing.DefaultButtonModel.PRESSED

public static final int PRESSED
Indicates that the button has been "pressed" (typically, when the mouse is released).

See Also:
Constant Field Values

ENABLED sample code for javax.swing.DefaultButtonModel.ENABLED

public static final int ENABLED
Indicates that the button can be selected by an input device (such as a mouse pointer).

See Also:
Constant Field Values

ROLLOVER sample code for javax.swing.DefaultButtonModel.ROLLOVER

public static final int ROLLOVER
Indicates that the mouse is over the button.

See Also:
Constant Field Values
Constructor Detail

DefaultButtonModel sample code for javax.swing.DefaultButtonModel() definition code for javax.swing.DefaultButtonModel()

public DefaultButtonModel()
Constructs a default JButtonModel.

Method Detail

setActionCommand sample code for javax.swing.DefaultButtonModel.setActionCommand(java.lang.String) definition code for javax.swing.DefaultButtonModel.setActionCommand(java.lang.String)

public void setActionCommand(String sample code for java.lang.String definition code for java.lang.String  actionCommand)
Sets the actionCommand string that gets sent as part of the event when the button is pressed.

Specified by:
setActionCommand sample code for javax.swing.ButtonModel.setActionCommand(java.lang.String) definition code for javax.swing.ButtonModel.setActionCommand(java.lang.String) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
actionCommand - the String that identifies the generated event

getActionCommand sample code for javax.swing.DefaultButtonModel.getActionCommand() definition code for javax.swing.DefaultButtonModel.getActionCommand()

public String sample code for java.lang.String definition code for java.lang.String  getActionCommand()
Returns the action command for this button.

Specified by:
getActionCommand sample code for javax.swing.ButtonModel.getActionCommand() definition code for javax.swing.ButtonModel.getActionCommand() in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Returns:
the String that identifies the generated event
See Also:
setActionCommand(java.lang.String) sample code for javax.swing.DefaultButtonModel.setActionCommand(java.lang.String) definition code for javax.swing.DefaultButtonModel.setActionCommand(java.lang.String)

isArmed sample code for javax.swing.DefaultButtonModel.isArmed() definition code for javax.swing.DefaultButtonModel.isArmed()

public boolean isArmed()
Indicates partial commitment towards pressing the button.

Specified by:
isArmed sample code for javax.swing.ButtonModel.isArmed() definition code for javax.swing.ButtonModel.isArmed() in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Returns:
true if the button is armed, and ready to be pressed
See Also:
setArmed(boolean) sample code for javax.swing.DefaultButtonModel.setArmed(boolean) definition code for javax.swing.DefaultButtonModel.setArmed(boolean)

isSelected sample code for javax.swing.DefaultButtonModel.isSelected() definition code for javax.swing.DefaultButtonModel.isSelected()

public boolean isSelected()
Indicates if the button has been selected. Only needed for certain types of buttons - such as RadioButton or Checkbox.

Specified by:
isSelected sample code for javax.swing.ButtonModel.isSelected() definition code for javax.swing.ButtonModel.isSelected() in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Returns:
true if the button is selected

isEnabled sample code for javax.swing.DefaultButtonModel.isEnabled() definition code for javax.swing.DefaultButtonModel.isEnabled()

public boolean isEnabled()
Indicates whether the button can be selected or pressed by an input device (such as a mouse pointer). (Checkbox-buttons are selected, regular buttons are "pressed".)

Specified by:
isEnabled sample code for javax.swing.ButtonModel.isEnabled() definition code for javax.swing.ButtonModel.isEnabled() in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Returns:
true if the button is enabled, and therefore selectable (or pressable)

isPressed sample code for javax.swing.DefaultButtonModel.isPressed() definition code for javax.swing.DefaultButtonModel.isPressed()

public boolean isPressed()
Indicates whether button has been pressed.

Specified by:
isPressed sample code for javax.swing.ButtonModel.isPressed() definition code for javax.swing.ButtonModel.isPressed() in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Returns:
true if the button has been pressed

isRollover sample code for javax.swing.DefaultButtonModel.isRollover() definition code for javax.swing.DefaultButtonModel.isRollover()

public boolean isRollover()
Indicates that the mouse is over the button.

Specified by:
isRollover sample code for javax.swing.ButtonModel.isRollover() definition code for javax.swing.ButtonModel.isRollover() in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Returns:
true if the mouse is over the button

setArmed sample code for javax.swing.DefaultButtonModel.setArmed(boolean) definition code for javax.swing.DefaultButtonModel.setArmed(boolean)

public void setArmed(boolean b)
Marks the button as "armed". If the mouse button is released while it is over this item, the button's action event fires. If the mouse button is released elsewhere, the event does not fire and the button is disarmed.

Specified by:
setArmed sample code for javax.swing.ButtonModel.setArmed(boolean) definition code for javax.swing.ButtonModel.setArmed(boolean) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
b - true to arm the button so it can be selected

setEnabled sample code for javax.swing.DefaultButtonModel.setEnabled(boolean) definition code for javax.swing.DefaultButtonModel.setEnabled(boolean)

public void setEnabled(boolean b)
Enables or disables the button.

Specified by:
setEnabled sample code for javax.swing.ButtonModel.setEnabled(boolean) definition code for javax.swing.ButtonModel.setEnabled(boolean) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
b - true to enable the button
See Also:
isEnabled() sample code for javax.swing.DefaultButtonModel.isEnabled() definition code for javax.swing.DefaultButtonModel.isEnabled()

setSelected sample code for javax.swing.DefaultButtonModel.setSelected(boolean) definition code for javax.swing.DefaultButtonModel.setSelected(boolean)

public void setSelected(boolean b)
Selects or deselects the button.

Specified by:
setSelected sample code for javax.swing.ButtonModel.setSelected(boolean) definition code for javax.swing.ButtonModel.setSelected(boolean) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
b - true selects the button, false deselects the button

setPressed sample code for javax.swing.DefaultButtonModel.setPressed(boolean) definition code for javax.swing.DefaultButtonModel.setPressed(boolean)

public void setPressed(boolean b)
Sets the button to pressed or unpressed.

Specified by:
setPressed sample code for javax.swing.ButtonModel.setPressed(boolean) definition code for javax.swing.ButtonModel.setPressed(boolean) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
b - true to set the button to "pressed"
See Also:
isPressed() sample code for javax.swing.DefaultButtonModel.isPressed() definition code for javax.swing.DefaultButtonModel.isPressed()

setRollover sample code for javax.swing.DefaultButtonModel.setRollover(boolean) definition code for javax.swing.DefaultButtonModel.setRollover(boolean)

public void setRollover(boolean b)
Sets or clears the button's rollover state

Specified by:
setRollover sample code for javax.swing.ButtonModel.setRollover(boolean) definition code for javax.swing.ButtonModel.setRollover(boolean) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
b - true to turn on rollover
See Also:
isRollover() sample code for javax.swing.DefaultButtonModel.isRollover() definition code for javax.swing.DefaultButtonModel.isRollover()

setMnemonic sample code for javax.swing.DefaultButtonModel.setMnemonic(int) definition code for javax.swing.DefaultButtonModel.setMnemonic(int)

public void setMnemonic(int key)
Sets the keyboard mnemonic (shortcut key or accelerator key) for this button.

Specified by:
setMnemonic sample code for javax.swing.ButtonModel.setMnemonic(int) definition code for javax.swing.ButtonModel.setMnemonic(int) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
key - an int specifying the accelerator key

getMnemonic sample code for javax.swing.DefaultButtonModel.getMnemonic() definition code for javax.swing.DefaultButtonModel.getMnemonic()

public int getMnemonic()
Gets the keyboard mnemonic for this model

Specified by:
getMnemonic sample code for javax.swing.ButtonModel.getMnemonic() definition code for javax.swing.ButtonModel.getMnemonic() in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Returns:
an int specifying the accelerator key
See Also:
setMnemonic(int) sample code for javax.swing.DefaultButtonModel.setMnemonic(int) definition code for javax.swing.DefaultButtonModel.setMnemonic(int)

addChangeListener sample code for javax.swing.DefaultButtonModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.DefaultButtonModel.addChangeListener(javax.swing.event.ChangeListener)

public void addChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Adds a ChangeListener to the button.

Specified by:
addChangeListener sample code for javax.swing.ButtonModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.ButtonModel.addChangeListener(javax.swing.event.ChangeListener) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
l - the listener to add

removeChangeListener sample code for javax.swing.DefaultButtonModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.DefaultButtonModel.removeChangeListener(javax.swing.event.ChangeListener)

public void removeChangeListener(ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener  l)
Removes a ChangeListener from the button.

Specified by:
removeChangeListener sample code for javax.swing.ButtonModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.ButtonModel.removeChangeListener(javax.swing.event.ChangeListener) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
l - the listener to remove

getChangeListeners sample code for javax.swing.DefaultButtonModel.getChangeListeners() definition code for javax.swing.DefaultButtonModel.getChangeListeners()

public ChangeListener sample code for javax.swing.event.ChangeListener definition code for javax.swing.event.ChangeListener [] getChangeListeners()
Returns an array of all the change listeners registered on this DefaultButtonModel.

Returns:
all of this model's ChangeListeners or an empty array if no change listeners are currently registered
Since:
1.4
See Also:
addChangeListener(javax.swing.event.ChangeListener) sample code for javax.swing.DefaultButtonModel.addChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.DefaultButtonModel.addChangeListener(javax.swing.event.ChangeListener) , removeChangeListener(javax.swing.event.ChangeListener) sample code for javax.swing.DefaultButtonModel.removeChangeListener(javax.swing.event.ChangeListener) definition code for javax.swing.DefaultButtonModel.removeChangeListener(javax.swing.event.ChangeListener)

fireStateChanged sample code for javax.swing.DefaultButtonModel.fireStateChanged() definition code for javax.swing.DefaultButtonModel.fireStateChanged()

protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is created lazily.

See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList

addActionListener sample code for javax.swing.DefaultButtonModel.addActionListener(java.awt.event.ActionListener) definition code for javax.swing.DefaultButtonModel.addActionListener(java.awt.event.ActionListener)

public void addActionListener(ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
Adds an ActionListener to the button.

Specified by:
addActionListener sample code for javax.swing.ButtonModel.addActionListener(java.awt.event.ActionListener) definition code for javax.swing.ButtonModel.addActionListener(java.awt.event.ActionListener) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
l - the listener to add

removeActionListener sample code for javax.swing.DefaultButtonModel.removeActionListener(java.awt.event.ActionListener) definition code for javax.swing.DefaultButtonModel.removeActionListener(java.awt.event.ActionListener)

public void removeActionListener(ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener  l)
Removes an ActionListener from the button.

Specified by:
removeActionListener sample code for javax.swing.ButtonModel.removeActionListener(java.awt.event.ActionListener) definition code for javax.swing.ButtonModel.removeActionListener(java.awt.event.ActionListener) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
l - the listener to remove

getActionListeners sample code for javax.swing.DefaultButtonModel.getActionListeners() definition code for javax.swing.DefaultButtonModel.getActionListeners()

public ActionListener sample code for java.awt.event.ActionListener definition code for java.awt.event.ActionListener [] getActionListeners()
Returns an array of all the action listeners registered on this DefaultButtonModel.

Returns:
all of this model's ActionListeners or an empty array if no action listeners are currently registered
Since:
1.4
See Also:
addActionListener(java.awt.event.ActionListener) sample code for javax.swing.DefaultButtonModel.addActionListener(java.awt.event.ActionListener) definition code for javax.swing.DefaultButtonModel.addActionListener(java.awt.event.ActionListener) , removeActionListener(java.awt.event.ActionListener) sample code for javax.swing.DefaultButtonModel.removeActionListener(java.awt.event.ActionListener) definition code for javax.swing.DefaultButtonModel.removeActionListener(java.awt.event.ActionListener)

fireActionPerformed sample code for javax.swing.DefaultButtonModel.fireActionPerformed(java.awt.event.ActionEvent) definition code for javax.swing.DefaultButtonModel.fireActionPerformed(java.awt.event.ActionEvent)

protected void fireActionPerformed(ActionEvent sample code for java.awt.event.ActionEvent definition code for java.awt.event.ActionEvent  e)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
e - the ActionEvent to deliver to listeners
See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList

addItemListener sample code for javax.swing.DefaultButtonModel.addItemListener(java.awt.event.ItemListener) definition code for javax.swing.DefaultButtonModel.addItemListener(java.awt.event.ItemListener)

public void addItemListener(ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
Adds an ItemListener to the button.

Specified by:
addItemListener sample code for java.awt.ItemSelectable.addItemListener(java.awt.event.ItemListener) definition code for java.awt.ItemSelectable.addItemListener(java.awt.event.ItemListener) in interface ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable
Specified by:
addItemListener sample code for javax.swing.ButtonModel.addItemListener(java.awt.event.ItemListener) definition code for javax.swing.ButtonModel.addItemListener(java.awt.event.ItemListener) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
l - the listener to add
See Also:
ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent

removeItemListener sample code for javax.swing.DefaultButtonModel.removeItemListener(java.awt.event.ItemListener) definition code for javax.swing.DefaultButtonModel.removeItemListener(java.awt.event.ItemListener)

public void removeItemListener(ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener  l)
Removes an ItemListener from the button.

Specified by:
removeItemListener sample code for java.awt.ItemSelectable.removeItemListener(java.awt.event.ItemListener) definition code for java.awt.ItemSelectable.removeItemListener(java.awt.event.ItemListener) in interface ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable
Specified by:
removeItemListener sample code for javax.swing.ButtonModel.removeItemListener(java.awt.event.ItemListener) definition code for javax.swing.ButtonModel.removeItemListener(java.awt.event.ItemListener) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
l - the listener to remove
See Also:
ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent

getItemListeners sample code for javax.swing.DefaultButtonModel.getItemListeners() definition code for javax.swing.DefaultButtonModel.getItemListeners()

public ItemListener sample code for java.awt.event.ItemListener definition code for java.awt.event.ItemListener [] getItemListeners()
Returns an array of all the item listeners registered on this DefaultButtonModel.

Returns:
all of this model's ItemListeners or an empty array if no item listeners are currently registered
Since:
1.4
See Also:
addItemListener(java.awt.event.ItemListener) sample code for javax.swing.DefaultButtonModel.addItemListener(java.awt.event.ItemListener) definition code for javax.swing.DefaultButtonModel.addItemListener(java.awt.event.ItemListener) , removeItemListener(java.awt.event.ItemListener) sample code for javax.swing.DefaultButtonModel.removeItemListener(java.awt.event.ItemListener) definition code for javax.swing.DefaultButtonModel.removeItemListener(java.awt.event.ItemListener)

fireItemStateChanged sample code for javax.swing.DefaultButtonModel.fireItemStateChanged(java.awt.event.ItemEvent) definition code for javax.swing.DefaultButtonModel.fireItemStateChanged(java.awt.event.ItemEvent)

protected void fireItemStateChanged(ItemEvent sample code for java.awt.event.ItemEvent definition code for java.awt.event.ItemEvent  e)
Notifies all listeners that have registered interest for notification on this event type.

Parameters:
e - the ItemEvent to deliver to listeners
See Also:
EventListenerList sample code for javax.swing.event.EventListenerList definition code for javax.swing.event.EventListenerList

getListeners sample code for javax.swing.DefaultButtonModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>) definition code for javax.swing.DefaultButtonModel.<T extends java.util.EventListener>getListeners(java.lang.Class<T>)

public <T extends EventListener sample code for java.util.EventListener definition code for java.util.EventListener > T[] getListeners(Class sample code for java.lang.Class definition code for java.lang.Class <T> 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 listenerType argument with a class literal, such as FooListener.class. For example, you can query a DefaultButtonModel instance m for its action listeners with the following code:

ActionListener[] als = (ActionListener[])(m.getListeners(ActionListener.class));
If no such listeners exist, this method returns an empty array.

Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this model, or an empty array if no such listeners have been added
Throws:
ClassCastException sample code for java.lang.ClassCastException definition code for java.lang.ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
1.3
See Also:
getActionListeners() sample code for javax.swing.DefaultButtonModel.getActionListeners() definition code for javax.swing.DefaultButtonModel.getActionListeners() , getChangeListeners() sample code for javax.swing.DefaultButtonModel.getChangeListeners() definition code for javax.swing.DefaultButtonModel.getChangeListeners() , getItemListeners() sample code for javax.swing.DefaultButtonModel.getItemListeners() definition code for javax.swing.DefaultButtonModel.getItemListeners()

getSelectedObjects sample code for javax.swing.DefaultButtonModel.getSelectedObjects() definition code for javax.swing.DefaultButtonModel.getSelectedObjects()

public Object sample code for java.lang.Object definition code for java.lang.Object [] getSelectedObjects()
Overridden to return null.

Specified by:
getSelectedObjects sample code for java.awt.ItemSelectable.getSelectedObjects() definition code for java.awt.ItemSelectable.getSelectedObjects() in interface ItemSelectable sample code for java.awt.ItemSelectable definition code for java.awt.ItemSelectable

setGroup sample code for javax.swing.DefaultButtonModel.setGroup(javax.swing.ButtonGroup) definition code for javax.swing.DefaultButtonModel.setGroup(javax.swing.ButtonGroup)

public void setGroup(ButtonGroup sample code for javax.swing.ButtonGroup definition code for javax.swing.ButtonGroup  group)
Identifies the group this button belongs to -- needed for radio buttons, which are mutually exclusive within their group.

Specified by:
setGroup sample code for javax.swing.ButtonModel.setGroup(javax.swing.ButtonGroup) definition code for javax.swing.ButtonModel.setGroup(javax.swing.ButtonGroup) in interface ButtonModel sample code for javax.swing.ButtonModel definition code for javax.swing.ButtonModel
Parameters:
group - the ButtonGroup this button belongs to

getGroup sample code for javax.swing.DefaultButtonModel.getGroup() definition code for javax.swing.DefaultButtonModel.getGroup()

public ButtonGroup sample code for javax.swing.ButtonGroup definition code for javax.swing.ButtonGroup  getGroup()
Returns the group that this button belongs to. Normally used with radio buttons, which are mutually exclusive within their group.

Returns:
a ButtonGroup that this button belongs to
Since:
1.3