Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.DefaultButtonModel

java.lang.Object
  |
  +--com.sun.java.swing.DefaultButtonModel
Subclasses:
JToggleButton.ToggleButtonModel

public class DefaultButtonModel
extends java.lang.Object
implements ButtonModel, 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 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.

See Also:
Serialized Form

Field Summary
java.lang.String actionCommand
           
static int ARMED
          Indicates if the button can be selected or not by an input device (such as a mouse pointer).
ChangeEvent changeEvent
          Only one ChangeEvent is needed per button model instance since the event's only state is the source property.
static int ENABLED
          Indicates whether the button is currently enabled.
ButtonGroup group
           
EventListenerList listenerList
           
int mnemonic
           
static int PRESSED
          Indicates partial commitment towards choosing the button.
static int ROLLOVER
          Indicates that the mouse is over the button.
static int SELECTED
          Indicates if the button has been selected.
int stateMask
           
 
Constructor Summary
DefaultButtonModel()
          Constructs a JButtonModel
 
Method Summary
void addActionListener(java.awt.event.ActionListener l)
          adds an ActionListener to the button
void addChangeListener(ChangeListener l)
          Adds a ChangeListener to the button.
void addItemListener(java.awt.event.ItemListener l)
          adds an ItemListener to the button
void fireActionPerformed(java.awt.event.ActionEvent e)
           
void fireItemStateChanged(java.awt.event.ItemEvent e)
           
void fireStateChanged()
           
java.lang.String getActionCommand()
          Returns the action command for this button.
int getMnemonic()
          Gets the keyboard mnemonic for this model
java.lang.Object[] getSelectedObjects()
           
boolean isArmed()
          Returns whether the button is "armed".
boolean isEnabled()
          Checks if the button is disabled.
boolean isPressed()
          Checks if the button is pressed.
boolean isRollover()
          Checks if the button is rolled over.
boolean isSelected()
          Checks if the button is selected.
void removeActionListener(java.awt.event.ActionListener l)
          removes an ActionListener from the button
void removeChangeListener(ChangeListener l)
          Removes a ChangeListener from the button.
void removeItemListener(java.awt.event.ItemListener l)
          removes an ItemListener from the button
void setActionCommand(java.lang.String actionCommand)
          Sets the actionCommand that gets sent when the putton is pressed.
void setArmed(boolean b)
          Identifies the button as "armed".
void setEnabled(boolean b)
          Sets the button to be enabled or disabled state
void setGroup(ButtonGroup group)
           
void setMnemonic(int key)
          Sets the keyboard mnemonic for this model
void setPressed(boolean b)
          Sets the button to pressed state
void setRollover(boolean b)
          Sets the button to the rollover state
void setSelected(boolean b)
          Sets the selected state of the button.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

stateMask

protected int stateMask

actionCommand

protected java.lang.String actionCommand

group

protected ButtonGroup group

mnemonic

protected int mnemonic

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".

listenerList

protected EventListenerList listenerList

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

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.

PRESSED

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

ENABLED

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

ROLLOVER

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

DefaultButtonModel

public DefaultButtonModel()
Constructs a JButtonModel
Method Detail

setActionCommand

public void setActionCommand(java.lang.String actionCommand)
Sets the actionCommand that gets sent when the putton is pressed.
Specified by:
setActionCommand in interface ButtonModel

getActionCommand

public java.lang.String getActionCommand()
Returns the action command for this button.
Specified by:
getActionCommand in interface ButtonModel

isArmed

public boolean isArmed()
Returns whether the button is "armed".
Specified by:
isArmed in interface ButtonModel
Returns:
true if the button is armed, and it can be selected
See Also:
setArmed

isSelected

public boolean isSelected()
Checks if the button is selected.
Specified by:
isSelected in interface ButtonModel

isEnabled

public boolean isEnabled()
Checks if the button is disabled.
Specified by:
isEnabled in interface ButtonModel

isPressed

public boolean isPressed()
Checks if the button is pressed.
Specified by:
isPressed in interface ButtonModel

isRollover

public boolean isRollover()
Checks if the button is rolled over.
Specified by:
isRollover in interface ButtonModel

setArmed

public void setArmed(boolean b)
Identifies the button as "armed".
Specified by:
setArmed in interface ButtonModel
Parameters:
b - true to arm the button so it can be selected
See Also:
setArmed

setEnabled

public void setEnabled(boolean b)
Sets the button to be enabled or disabled state
Specified by:
setEnabled in interface ButtonModel

setSelected

public void setSelected(boolean b)
Sets the selected state of the button.
Specified by:
setSelected in interface ButtonModel
Parameters:
b - true selects the toggle button, false deselects the toggle button.

setPressed

public void setPressed(boolean b)
Sets the button to pressed state
Specified by:
setPressed in interface ButtonModel

setRollover

public void setRollover(boolean b)
Sets the button to the rollover state
Specified by:
setRollover in interface ButtonModel

setMnemonic

public void setMnemonic(int key)
Sets the keyboard mnemonic for this model
Specified by:
setMnemonic in interface ButtonModel

getMnemonic

public int getMnemonic()
Gets the keyboard mnemonic for this model
Specified by:
getMnemonic in interface ButtonModel

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener to the button.
Specified by:
addChangeListener in interface ButtonModel

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button.
Specified by:
removeChangeListener in interface ButtonModel

fireStateChanged

protected void fireStateChanged()

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
adds an ActionListener to the button
Specified by:
addActionListener in interface ButtonModel

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
removes an ActionListener from the button
Specified by:
removeActionListener in interface ButtonModel

fireActionPerformed

protected void fireActionPerformed(java.awt.event.ActionEvent e)

addItemListener

public void addItemListener(java.awt.event.ItemListener l)
adds an ItemListener to the button
Specified by:
addItemListener in interface ButtonModel

removeItemListener

public void removeItemListener(java.awt.event.ItemListener l)
removes an ItemListener from the button
Specified by:
removeItemListener in interface ButtonModel

fireItemStateChanged

protected void fireItemStateChanged(java.awt.event.ItemEvent e)

getSelectedObjects

public java.lang.Object[] getSelectedObjects()

setGroup

public void setGroup(ButtonGroup group)
Description copied from interface:
 
Specified by:
setGroup in interface ButtonModel

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.