void (ActionEvent e) { JCheckBox toUncheck = null; if (myStartTracing.isSelected() && myEndTracing.isSelected()) { Object source = e.getSource(); if (myStartTracing.equals(source)) { toUncheck = myEndTracing; } else if (myEndTracing.equals(source)) { toUncheck = myStartTracing; } if (toUncheck != null) { toUncheck.setSelected(false); } } }