All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.DefaultButtonModel

java.lang.Object
   |
   +----com.sun.java.swing.DefaultButtonModel

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.


Variable Index

 o actionCommand
 o ARMED
Indicates if the button can be selected or not by an input device (such as a mouse pointer).
 o changeEvent
Only one ChangeEvent is needed per button model instance since the event's only state is the source property.
 o ENABLED
Indicates whether the button is currently enabled.
 o group
 o listenerList
 o mnemonic
 o PRESSED
Indicates partial commitment towards choosing the button.
 o ROLLOVER
Indicates that the mouse is over the button.
 o SELECTED
Indicates if the button has been selected.
 o stateMask

Constructor Index

 o DefaultButtonModel()
Constructs a JButtonModel

Method Index

 o addActionListener(ActionListener)
adds an ActionListener to the button
 o addChangeListener(ChangeListener)
Adds a ChangeListener to the button.
 o addItemListener(ItemListener)
adds an ItemListener to the button
 o fireActionPerformed(ActionEvent)
 o fireItemStateChanged(ItemEvent)
 o fireStateChanged()
 o getActionCommand()
Returns the action command for this button.
 o getMnemonic()
Gets the keyboard mnemonic for this model
 o getSelectedObjects()
 o isArmed()
Returns whether the button is "armed".
 o isEnabled()
Checks if the button is disabled.
 o isPressed()
Checks if the button is pressed.
 o isRollover()
Checks if the button is rolled over.
 o isSelected()
Checks if the button is selected.
 o removeActionListener(ActionListener)
removes an ActionListener from the button
 o removeChangeListener(ChangeListener)
Removes a ChangeListener from the button.
 o removeItemListener(ItemListener)
removes an ItemListener from the button
 o setActionCommand(String)
Sets the actionCommand that gets sent when the putton is pressed.
 o setArmed(boolean)
Identifies the button as "armed".
 o setEnabled(boolean)
Sets the button to be enabled or disabled state
 o setGroup(ButtonGroup)
 o setMnemonic(int)
Sets the keyboard mnemonic for this model
 o setPressed(boolean)
Sets the button to pressed state
 o setRollover(boolean)
Sets the button to the rollover state
 o setSelected(boolean)
Sets the selected state of the button.

Variables

 o stateMask
 protected int stateMask
 o actionCommand
 protected String actionCommand
 o group
 protected ButtonGroup group
 o mnemonic
 protected int mnemonic
 o 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".

 o listenerList
 protected EventListenerList listenerList
 o 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
 o 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.

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

 o ENABLED
 public static final int ENABLED
Indicates whether the button is currently enabled.

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

Constructors

 o DefaultButtonModel
 public DefaultButtonModel()
Constructs a JButtonModel

Methods

 o setActionCommand
 public void setActionCommand(String actionCommand)
Sets the actionCommand that gets sent when the putton is pressed.

 o getActionCommand
 public String getActionCommand()
Returns the action command for this button.

 o isArmed
 public boolean isArmed()
Returns whether the button is "armed".

Returns:
true if the button is armed, and it can be selected
See Also:
setArmed
 o isSelected
 public boolean isSelected()
Checks if the button is selected.

 o isEnabled
 public boolean isEnabled()
Checks if the button is disabled.

 o isPressed
 public boolean isPressed()
Checks if the button is pressed.

 o isRollover
 public boolean isRollover()
Checks if the button is rolled over.

 o setArmed
 public void setArmed(boolean b)
Identifies the button as "armed".

Parameters:
b - true to arm the button so it can be selected
See Also:
setArmed
 o setEnabled
 public void setEnabled(boolean b)
Sets the button to be enabled or disabled state

 o setSelected
 public void setSelected(boolean b)
Sets the selected state of the button.

Parameters:
b - true selects the toggle button, false deselects the toggle button.
 o setPressed
 public void setPressed(boolean b)
Sets the button to pressed state

 o setRollover
 public void setRollover(boolean b)
Sets the button to the rollover state

 o setMnemonic
 public void setMnemonic(int key)
Sets the keyboard mnemonic for this model

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

 o addChangeListener
 public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.

 o removeChangeListener
 public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.

 o fireStateChanged
 protected void fireStateChanged()
 o addActionListener
 public void addActionListener(ActionListener l)
adds an ActionListener to the button

 o removeActionListener
 public void removeActionListener(ActionListener l)
removes an ActionListener from the button

 o fireActionPerformed
 protected void fireActionPerformed(ActionEvent e)
 o addItemListener
 public void addItemListener(ItemListener l)
adds an ItemListener to the button

 o removeItemListener
 public void removeItemListener(ItemListener l)
removes an ItemListener from the button

 o fireItemStateChanged
 protected void fireItemStateChanged(ItemEvent e)
 o getSelectedObjects
 public Object[] getSelectedObjects()
 o setGroup
 public void setGroup(ButtonGroup group)

All Packages  Class Hierarchy  This Package  Previous  Next  Index