http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JList.htmlAPI Doc - JList hat gesagt.:Code:final JList list = new JList(dataModel); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = list.locationToIndex(e.getPoint()); System.out.println("Double clicked on Item " + index); } } }; list.addMouseListener(mouseListener);
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
int index = userlist.locationToIndex(e.getPoint());
System.out.println(userlist.getComponent(index));
}
}
};
userlist.addMouseListener(mouseListener);