com.supermap.desktop.controls.ui
类 SmCheckBoxTristate
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.AbstractButton
-
- javax.swing.JToggleButton
-
- javax.swing.JCheckBox
-
- com.supermap.desktop.controls.ui.SmCheckBoxTristate
-
- 所有已实现的接口:
- java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants
public class SmCheckBoxTristate extends javax.swing.JCheckBox
Maintenance tip - There were some tricks to getting this code working:1. You have to overwite addMouseListener() to do nothing 2. You have to add a mouse event on mousePressed by calling super.addMouseListener() 3. You have to replace the UIActionMap for the keyboard event "pressed" with your own one. 4. You have to remove the UIActionMap for the keyboard event "released". 5. You have to grab focus when the next state is entered, otherwise clicking on the component won't get the focus. 6. You have to make a TristateDecorator as a button model that wraps the original button model and does state management. 多态复选框
- 另请参阅:
- 序列化表格
-
-
嵌套类概要
嵌套类 限定符和类型 类和说明 static class
SmCheckBoxTristate.State
This is a type-safe enumerated typeclass
SmCheckBoxTristate.TristateDecorator
Exactly which Design Pattern is this?
-
字段概要
字段 限定符和类型 字段和说明 static SmCheckBoxTristate.State
DONT_CARE
static SmCheckBoxTristate.State
NOT_SELECTED
static SmCheckBoxTristate.State
SELECTED
static java.lang.String
TRISTATE
-
构造器概要
构造器 构造器和说明 SmCheckBoxTristate()
SmCheckBoxTristate(java.lang.String text)
SmCheckBoxTristate(java.lang.String text, javax.swing.Icon icon, SmCheckBoxTristate.State initial)
SmCheckBoxTristate(java.lang.String text, SmCheckBoxTristate.State initial)
-
方法概要
所有方法 实例方法 具体方法 限定符和类型 方法和说明 void
addMouseListener(java.awt.event.MouseListener l)
No one may add mouse listeners, not even Swing!void
addStateChangeListener(com.supermap.desktop.controls.ui.StateChangeListener listener)
注册状态更改监听事件SmCheckBoxTristate.State
getState()
Return the current state, which is determined by the selection status of the model.java.lang.Boolean
isSelectedEx()
返回复选框选择状态void
removeStateChangeListener(com.supermap.desktop.controls.ui.StateChangeListener listener)
移除状态更改监听事件void
setSelected(boolean selected)
void
setSelectedEx(java.lang.Boolean selectedEx)
设置复选框选择状态void
setState(SmCheckBoxTristate.State state)
Set the new state to either SELECTED, NOT_SELECTED or DONT_CARE.void
setTristateDecoratorModel(SmCheckBoxTristate.TristateDecorator tristateDecoratorModel)
void
updateUI()
-
-
-
字段详细资料
-
NOT_SELECTED
public static final SmCheckBoxTristate.State NOT_SELECTED
-
SELECTED
public static final SmCheckBoxTristate.State SELECTED
-
DONT_CARE
public static final SmCheckBoxTristate.State DONT_CARE
-
TRISTATE
public static final java.lang.String TRISTATE
- 另请参阅:
- 常量字段值
-
-
构造器详细资料
-
SmCheckBoxTristate
public SmCheckBoxTristate(java.lang.String text, javax.swing.Icon icon, SmCheckBoxTristate.State initial)
- 参数:
text
- 显示文本icon
- 图标initial
- 初始状态
-
SmCheckBoxTristate
public SmCheckBoxTristate(java.lang.String text, SmCheckBoxTristate.State initial)
-
SmCheckBoxTristate
public SmCheckBoxTristate(java.lang.String text)
-
SmCheckBoxTristate
public SmCheckBoxTristate()
-
-
方法详细资料
-
addMouseListener
public void addMouseListener(java.awt.event.MouseListener l)
No one may add mouse listeners, not even Swing!- 覆盖:
addMouseListener
在类中java.awt.Component
-
getState
public SmCheckBoxTristate.State getState()
Return the current state, which is determined by the selection status of the model.
-
setState
public void setState(SmCheckBoxTristate.State state)
Set the new state to either SELECTED, NOT_SELECTED or DONT_CARE. If state == null, it is treated as DONT_CARE.
-
setTristateDecoratorModel
public void setTristateDecoratorModel(SmCheckBoxTristate.TristateDecorator tristateDecoratorModel)
-
updateUI
public void updateUI()
- 覆盖:
updateUI
在类中javax.swing.JCheckBox
-
isSelectedEx
public java.lang.Boolean isSelectedEx()
返回复选框选择状态- 返回:
-
setSelectedEx
public void setSelectedEx(java.lang.Boolean selectedEx)
设置复选框选择状态
-
setSelected
public void setSelected(boolean selected)
- 覆盖:
setSelected
在类中javax.swing.AbstractButton
-
addStateChangeListener
public void addStateChangeListener(com.supermap.desktop.controls.ui.StateChangeListener listener)
注册状态更改监听事件- 参数:
listener
-
-
removeStateChangeListener
public void removeStateChangeListener(com.supermap.desktop.controls.ui.StateChangeListener listener)
移除状态更改监听事件- 参数:
listener
-
-
-