public static class JToggleButton.ToggleButtonModel extends DefaultButtonModel
警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,对所有JavaBeans的长期存储的支持已经添加到java.beans
包中。 请参阅XMLEncoder
。
actionCommand, ARMED, changeEvent, ENABLED, group, listenerList, mnemonic, PRESSED, ROLLOVER, SELECTED, stateMask
Constructor and Description |
---|
ToggleButtonModel()
创建一个新的ToggleButton模型
|
Modifier and Type | Method and Description |
---|---|
boolean |
isSelected()
检查按钮是否被选中。
|
void |
setPressed(boolean b)
设置切换按钮的按下状态。
|
void |
setSelected(boolean b)
设置按钮的选定状态。
|
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
public boolean isSelected()
isSelected
在接口
ButtonModel
isSelected
在
DefaultButtonModel
true
如果按钮被选中
public void setSelected(boolean b)
setSelected
在界面
ButtonModel
setSelected
在
DefaultButtonModel
b
- true选择切换按钮,false取消选择切换按钮。
public void setPressed(boolean b)
setPressed
在接口
ButtonModel
setPressed
在
DefaultButtonModel
b
- 是否应该按下按钮
ButtonModel.isPressed()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.