first off, you have not even tried yet, right? Swing does almost everything input related with listeneres. Check out the mouse listener, or adjust the awnser giving below
https://stackoverflow.com/a/4344762/258418
For completness I quote it here:
String[] items = {"A", "B", "C", "D"};
JList list = new JList(items);
list.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent evt) {
JList list = (JList)evt.getSource();
if (evt.getClickCount() == 2) {
int index = list.locationToIndex(evt.getPoint());
} else if (evt.getClickCount() == 3) { // Triple-click
int index = list.locationToIndex(evt.getPoint());
}
}
});
I am sure you can make it take single clicks as well,... if not write a comment