void (final ActionEvent e) { ThreeStateCheckBox.State state = myCommon.getState(); for (int i = 0; i < myCheckBoxesList.size(); i++) { boolean value = state == ThreeStateCheckBox.State.SELECTED ? true : state == ThreeStateCheckBox.State.NOT_SELECTED ? false : myInitialValues.get(i); JCheckBox checkBox = myCheckBoxesList.get(i); if (value != checkBox.isSelected()) { ButtonModel model = checkBox.getModel(); model.setArmed(true); model.setPressed(true); model.setPressed(false); model.setArmed(false); } } }