Adding an ActionListener to a JList
问题 I have a JList with an array of strings. Basically it displays a restaurant menu. right next to the JList i have another JList which is empty. Whenever a user double clicks on a string in the first JList (where the menu is displayed) I want it to show up on the next JList which is right next to it. how do i do that? 回答1: You can try final JList list = new JList(dataModel); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) {