|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.DefaultButtonModel
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. A future release of Swing will provide support for long term persistence.
Field Summary | |
protected String |
actionCommand
|
static int |
ARMED
Indicates partial commitment towards choosing the button. |
protected 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 that the button can be selected by an input device (such as a mouse pointer). |
protected ButtonGroup |
group
|
protected EventListenerList |
listenerList
|
protected int |
mnemonic
|
static int |
PRESSED
Indicates that the button has been "pressed" (typically, when the mouse is released). |
static int |
ROLLOVER
Indicates that the mouse is over the button. |
static int |
SELECTED
Indicates that the button has been selected. |
protected int |
stateMask
|
Constructor Summary | |
DefaultButtonModel()
Constructs a JButtonModel |
Method Summary | |
void |
addActionListener(ActionListener l)
Adds an ActionListener to the button. |
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener to the button. |
void |
addItemListener(ItemListener l)
Adds an ItemListener to the button. |
protected void |
fireActionPerformed(ActionEvent e)
|
protected void |
fireItemStateChanged(ItemEvent e)
|
protected void |
fireStateChanged()
|
String |
getActionCommand()
Returns the action command for this button. |
int |
getMnemonic()
Gets the keyboard mnemonic for this model |
Object[] |
getSelectedObjects()
Overriden to return null |
boolean |
isArmed()
Indicates partial commitment towards pressing the button. |
boolean |
isEnabled()
Indicates if the button can be selected or pressed by an input device (such as a mouse pointer). |
boolean |
isPressed()
Indicates if button has been pressed. |
boolean |
isRollover()
Indicates that the mouse is over the button. |
boolean |
isSelected()
Indicates if the button has been selected. |
void |
removeActionListener(ActionListener l)
Removes an ActionListener from the button. |
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from the button. |
void |
removeItemListener(ItemListener l)
Removes an ItemListener from the button. |
void |
setActionCommand(String actionCommand)
Sets the actionCommand string that gets sent as part of the event when the button is pressed. |
void |
setArmed(boolean b)
Marks the button as "armed". |
void |
setEnabled(boolean b)
Enables or disables the button. |
void |
setGroup(ButtonGroup group)
Identifies the group this button belongs to -- needed for radio buttons, which are mutually exclusive within their group. |
void |
setMnemonic(int key)
Sets the keyboard mnemonic (shortcut key or accelerator key) for this button. |
void |
setPressed(boolean b)
Sets the button to pressed or unpressed. |
void |
setRollover(boolean b)
Sets or clears the button's rollover state |
void |
setSelected(boolean b)
Selects or deselects the button. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected int stateMask
protected String actionCommand
protected ButtonGroup group
protected int mnemonic
protected transient ChangeEvent changeEvent
protected EventListenerList listenerList
public static final int ARMED
public static final int SELECTED
public static final int PRESSED
public static final int ENABLED
public static final int ROLLOVER
Constructor Detail |
public DefaultButtonModel()
Method Detail |
public void setActionCommand(String actionCommand)
s
- the String that identifies the generated eventpublic String getActionCommand()
setActionCommand(java.lang.String)
public boolean isArmed()
setArmed(boolean)
public boolean isSelected()
public boolean isEnabled()
public boolean isPressed()
public boolean isRollover()
public void setArmed(boolean b)
b
- true to arm the button so it can be selectedpublic void setEnabled(boolean b)
b
- true to enable the buttonisEnabled()
public void setSelected(boolean b)
b
- true selects the button,
false deselects the button.public void setPressed(boolean b)
b
- true to set the button to "pressed"isPressed()
public void setRollover(boolean b)
b
- true to turn on rolloverisRollover()
public void setMnemonic(int key)
key
- an int specifying the accelerator keypublic int getMnemonic()
setMnemonic(int)
public void addChangeListener(ChangeListener l)
l
- the listener to addpublic void removeChangeListener(ChangeListener l)
l
- the listener to removeprotected void fireStateChanged()
public void addActionListener(ActionListener l)
l
- the listener to addpublic void removeActionListener(ActionListener l)
l
- the listener to removeprotected void fireActionPerformed(ActionEvent e)
public void addItemListener(ItemListener l)
l
- the listener to addpublic void removeItemListener(ItemListener l)
l
- the listener to removeprotected void fireItemStateChanged(ItemEvent e)
public Object[] getSelectedObjects()
public void setGroup(ButtonGroup group)
group
- the ButtonGroup this button belongs to
|
Java Platform 1.2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |