@Override public void mousePressed(MouseEvent e) { int index = locationToIndex(e.getPoint()); if (index != -1) { setChecked(index, !getChecked(index)); repaint(); } } });
@Override public void keyTyped(KeyEvent e) { if ((e.getKeyChar() == ' ') && (e.getModifiers() == 0)) { int index = getSelectedIndex(); setChecked(index, !getChecked(index)); e.consume(); repaint(); } } });
@Override public void mousePressed(MouseEvent e) { int index = locationToIndex(e.getPoint()); if (index != -1) { setChecked(index, !getChecked(index)); repaint(); } } });
@Override public void keyTyped(KeyEvent e) { if ((e.getKeyChar() == ' ') && (e.getModifiers() == 0)) { int index = getSelectedIndex(); setChecked(index, !getChecked(index)); e.consume(); repaint(); } } });