Save This Page
Home » openjdk-7 » javax » swing » [javadoc | source]
javax.swing
public class: DefaultButtonModel [javadoc | source]
java.lang.Object
   javax.swing.DefaultButtonModel

All Implemented Interfaces:
    ButtonModel, Serializable

Direct Known Subclasses:
    ToggleButtonModel, ButtonHandler, ToggleButtonModel

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 java.beans.XMLEncoder .

Field Summary
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 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". 
protected  EventListenerList listenerList    Stores the listeners on this model. 
public static final  int ARMED    Identifies the "armed" bit in the bitmask, which indicates partial commitment towards choosing/triggering the button. 
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. 
public static final  int PRESSED    Identifies the "pressed" bit in the bitmask, which indicates that the button is pressed. 
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). 
public static final  int ROLLOVER    Identifies the "rollover" bit in the bitmask, which indicates that the mouse is over the button. 
Constructor:
 public DefaultButtonModel() 
Method from javax.swing.DefaultButtonModel Summary:
addActionListener,   addChangeListener,   addItemListener,   fireActionPerformed,   fireItemStateChanged,   fireStateChanged,   getActionCommand,   getActionListeners,   getChangeListeners,   getGroup,   getItemListeners,   getListeners,   getMnemonic,   getSelectedObjects,   isArmed,   isEnabled,   isMenuItem,   isPressed,   isRollover,   isSelected,   removeActionListener,   removeChangeListener,   removeItemListener,   setActionCommand,   setArmed,   setEnabled,   setGroup,   setMenuItem,   setMnemonic,   setPressed,   setRollover,   setSelected
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.DefaultButtonModel Detail:
 public  void addActionListener(ActionListener l) 
    {@inheritDoc}
 public  void addChangeListener(ChangeListener l) 
    {@inheritDoc}
 public  void addItemListener(ItemListener l) 
    {@inheritDoc}
 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 String getActionCommand() 
    {@inheritDoc}
 public ActionListener[] getActionListeners() 
    Returns an array of all the action listeners registered on this DefaultButtonModel.
 public ChangeListener[] getChangeListeners() 
    Returns an array of all the change listeners registered on this DefaultButtonModel.
 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 T[] getListeners(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.
 public int getMnemonic() 
    {@inheritDoc}
 public Object[] getSelectedObjects() 
    Overridden to return null.
 public boolean isArmed() 
    {@inheritDoc}
 public boolean isEnabled() 
    {@inheritDoc}
 boolean isMenuItem() 
 public boolean isPressed() 
    {@inheritDoc}
 public boolean isRollover() 
    {@inheritDoc}
 public boolean isSelected() 
    {@inheritDoc}
 public  void removeActionListener(ActionListener l) 
    {@inheritDoc}
 public  void removeChangeListener(ChangeListener l) 
    {@inheritDoc}
 public  void removeItemListener(ItemListener l) 
    {@inheritDoc}
 public  void setActionCommand(String actionCommand) 
    {@inheritDoc}
 public  void setArmed(boolean b) 
    {@inheritDoc}
 public  void setEnabled(boolean b) 
    {@inheritDoc}
 public  void setGroup(ButtonGroup group) 
    {@inheritDoc}
  void setMenuItem(boolean menuItem) 
 public  void setMnemonic(int key) 
    {@inheritDoc}
 public  void setPressed(boolean b) 
    {@inheritDoc}
 public  void setRollover(boolean b) 
    {@inheritDoc}
 public  void setSelected(boolean b) 
    {@inheritDoc}