void (KeyEvent e) { SpeedSearchSupply supply = SpeedSearchSupply.getSupply(CheckBoxList.this); if (supply != null && supply.isPopupActive()) { return; } if (e.getKeyChar() == ' ') { Boolean value = null; for (int index : getSelectedIndices()) { if (index >= 0) { JCheckBox checkbox = getCheckBoxAt(index); if (checkbox.isEnabled()) { value = value != null ? value : !checkbox.isSelected(); setSelected(checkbox, index, value); } } } } }