日期:2014-05-20 浏览次数:20688 次
TristateCheckBox checkBox = new TristateCheckBox("Tristate Check Box");
checkBox.setState(TristateCheckBox.STATE_MIXED);
checkBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int state = checkBox.getState();
switch (state) {
case TristateCheckBox.STATE_MIXED:
// mixed state
break;
case TristateCheckBox.STATE_UNSELECTED:
// unselected state
break;
case TristateCheckBox.STATE_SELECTED:
// selected state
break;
}
}
});