public class ToggleButtonModel extends JToggleButton.ToggleButtonModel
actionCommand, ARMED, changeEvent, ENABLED, group, listenerList, mnemonic, PRESSED, ROLLOVER, SELECTED, stateMask
Constructor and Description |
---|
ToggleButtonModel(String text,
Icon icon,
String shortdesc)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
JToggleButton |
createButton()
Creates and returns a normal button using this model.
|
JCheckBox |
createCheckBox()
Creates and returns a check box using this model.
|
JCheckBoxMenuItem |
createMenuItem()
Creates and returns a menu item using this model.
|
JRadioButton[] |
createRadioButtons(String name0,
String name1)
Creates and returns a pair of radio buttons using this model.
|
JToggleButton |
createToolbarButton()
Creates and returns a button suitable for use in a toolbar using
this model.
|
void |
fireActionPerformed(ActionEvent evt) |
String |
getDescription()
Returns the description (for tooltips etc) associated with this model.
|
Icon |
getIcon()
Returns the icon associated with this model.
|
String |
getText()
Returns the text label associated with this model.
|
boolean |
isSelected()
Returns the state of this model.
|
void |
setDescription(String shortdesc)
Sets the description (for tooltips etc) associated with this model.
|
void |
setIcon(Icon icon)
Sets the icon associated with this model.
|
void |
setSelected(boolean state)
Sets the state of this model.
|
void |
setText(String text)
Sets the text label associated with this model.
|
setPressed
addActionListener, addChangeListener, addItemListener, fireItemStateChanged, fireStateChanged, getActionCommand, getActionListeners, getChangeListeners, getGroup, getItemListeners, getListeners, getMnemonic, getSelectedObjects, isArmed, isEnabled, isPressed, isRollover, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setArmed, setEnabled, setGroup, setMnemonic, setRollover
public void setText(String text)
text
- button namepublic String getText()
public void setIcon(Icon icon)
icon
- button iconpublic Icon getIcon()
public void setDescription(String shortdesc)
shortdesc
- descriptionpublic String getDescription()
public JToggleButton createButton()
public JToggleButton createToolbarButton()
public JCheckBoxMenuItem createMenuItem()
public JCheckBox createCheckBox()
public JRadioButton[] createRadioButtons(String name0, String name1)
name0
- name of the Off controlname1
- name of the On controlpublic void setSelected(boolean state)
setSelected
in interface ButtonModel
setSelected
in class JToggleButton.ToggleButtonModel
state
- on/off statuspublic boolean isSelected()
isSelected
in interface ButtonModel
isSelected
in class JToggleButton.ToggleButtonModel
public void fireActionPerformed(ActionEvent evt)
fireActionPerformed
in class DefaultButtonModel
Copyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.