public class TristateButtonModel
extends javax.swing.JToggleButton.ToggleButtonModel
Modifier and Type | Field | Description |
---|---|---|
static int |
MIXED |
Identifies the "mixed" bit in the bitmask, which indicates that the button is partial selected.
|
Constructor | Description |
---|---|
TristateButtonModel() |
Modifier and Type | Method | Description |
---|---|---|
protected int |
getNextState(int current) |
We rotate between STATE_UNSELECTED, STATE_SELECTED and STATE_MIXED.
|
int |
getState() |
|
boolean |
isMixed() |
|
void |
setMixed(boolean b) |
|
void |
setPressed(boolean b) |
|
void |
setSelected(boolean b) |
|
void |
setState(int state) |
|
protected void |
updateState() |
Updates the state when the mouse is clicked.
|
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 static final int MIXED
public void setState(int state)
public int getState()
protected int getNextState(int current)
if (current == TristateCheckBox.STATE_UNSELECTED) {
return TristateCheckBox.STATE_SELECTED;
}
else if (current == TristateCheckBox.STATE_SELECTED) {
return TristateCheckBox.STATE_MIXED;
}
else if (current == TristateCheckBox.STATE_MIXED) {
return TristateCheckBox.STATE_UNSELECTED;
}
current
- the current statepublic void setPressed(boolean b)
setPressed
in class javax.swing.JToggleButton.ToggleButtonModel
protected void updateState()
setState(getNextState(getState()));
public void setSelected(boolean b)
setSelected
in class javax.swing.JToggleButton.ToggleButtonModel
public boolean isMixed()
public void setMixed(boolean b)