@Override
		public void keyPressed(KeyEvent e) {
			if (e.getKeyCode() == KeyEvent.VK_SPACE) {
				e.consume();
				JList<?> list = (JList<?>) e.getSource();
				int index = list.getSelectedIndex();
				if (index < 0) {
					return;
				}
				boolean selected = checkboxes[index].isSelected();
				checkboxes[index].setSelected(!selected);
				listPanel.repaint();
			}
		}
Mouse listener to get the selected cell in the list.
Ghidra/Framework/Project/src/main/java/ghidra/framework/main/SaveDataDialog.java