Menu
  • HOME
  • TAGS

Why can't I get to mouse click count == 2 first in Java?

java,swing,jlist,click-counting

OK, after some Goggling and my own enhancement, here is the code that works to my original expectations : boolean isAlreadyOneClick=false; ... DefaultListModel xlistModel=new DefaultListModel(); JList xlist=new JList(xlistModel); xlist.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { int index=xlist.locationToIndex(e.getPoint()); String item=xlistModel.getElementAt(index).toString(); if (SwingUtilities.isLeftMouseButton(e)) { if (isAlreadyOneClick) { System.out.println("Left double click :...