java.lang.Object
javax.swing.DefaultButtonModel
javax.swing.JToggleButton.ToggleButtonModel
- 所有已实现的接口:
-
ItemSelectable
,Serializable
,ButtonModel
- 封装类:
-
JToggleButton
切换按钮模型
警告: 该类的序列化对象将不兼容未来的Swing版本。当前的序列化支持适用于短期存储或在运行相同Swing版本的应用程序之间的RMI。从1.4版本开始,已将对所有JavaBeans的长期存储支持添加到java.beans
包中。请参阅XMLEncoder
。
-
Field Summary
Fields declared in class javax.swing.DefaultButtonModel
actionCommand, ARMED, changeEvent, ENABLED, group, listenerList, mnemonic, PRESSED, ROLLOVER, SELECTED, stateMask
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
检查按钮是否被选中。void
setPressed
(boolean b) 设置切换按钮的按下状态。void
setSelected
(boolean b) 设置按钮的选中状态。Methods declared in class javax.swing.DefaultButtonModel
addActionListener, addChangeListener, addItemListener, fireActionPerformed, fireItemStateChanged, fireStateChanged, getActionCommand, getActionListeners, getChangeListeners, getGroup, getItemListeners, getListeners, getMnemonic, getSelectedObjects, isArmed, isEnabled, isPressed, isRollover, removeActionListener, removeChangeListener, removeItemListener, setActionCommand, setArmed, setEnabled, setGroup, setMnemonic, setRollover
-
Constructor Details
-
ToggleButtonModel
public ToggleButtonModel()创建一个新的切换按钮模型
-
-
Method Details
-
isSelected
public boolean isSelected()检查按钮是否被选中。- 返回:
-
true
如果按钮被选中
-
setSelected
public void setSelected(boolean b) 设置按钮的选中状态。- 参数:
-
b
- true表示选择切换按钮,false表示取消选择切换按钮。
-
setPressed
public void setPressed(boolean b) 设置切换按钮的按下状态。- 参数:
-
b
- 按钮是否应该被按下 - 参见:
-