void (ActionEvent e) { JCheckBox toCheck = null; if (!myWatchAccessCheckBox.isSelected() && !myWatchModificationCheckBox.isSelected()) { Object source = e.getSource(); if (myWatchAccessCheckBox.equals(source)) { toCheck = myWatchModificationCheckBox; } else if (myWatchModificationCheckBox.equals(source)) { toCheck = myWatchAccessCheckBox; } if (toCheck != null) { toCheck.setSelected(true); } } }