MouseEvent doubleClick Listener
893630Oct 29 2012 — edited Oct 31 2012Hi,
I have a requirement in which when you click a node you call "action A" and on double click you call "action B".
I was using the following code all this while:
+Node.setOnMouseClicked(new EventHandler<MouseEvent>(){+*
+@Override+
+public void handle(MouseEvent arg0) {+*
+if(arg0.getClickCount()==1){+*
+// do Action A.+
+}+
+if(arg0.getClickCount()==2){+*
+// do Action B.+
+}+
+}+
+});+
However, on double click-- this also triggers first click action . To make the matter worse, if Action A called by first click takes substantial time , then double click is interpreted as two single clicks not a double Click and action B never gets executed.
Is there any Listener to differentiate single and double click?
Pls advice appropriate approach for this.
Thanks