Javafx 2 click and double click

Yes you can detect single, double even multiple clicks: myNode.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent mouseEvent) { if(mouseEvent.getButton().equals(MouseButton.PRIMARY)){ if(mouseEvent.getClickCount() == 2){ System.out.println(“Double clicked”); } } } }); MouseButton.PRIMARY is used to determine if the left (commonly) mouse button is triggered the event. Read the api of getClickCount() to conclude that there maybe multiple click … Read more

D3: How do I set “click” event and “dbclick” event at the same time?

You have to do your “own” doubleclick detection Something like that could work: var clickedOnce = false; var timer; $(“#test”).bind(“click”, function(){ if (clickedOnce) { run_on_double_click(); } else { timer = setTimeout(function() { run_on_simple_click(parameter); }, 150); clickedOnce = true; } }); function run_on_simple_click(parameter) { alert(parameter); alert(“simpleclick”); clickedOnce = false; } function run_on_double_click() { clickedOnce = false; … Read more

How to prevent a double-click using jQuery?

jQuery’s one() will fire the attached event handler once for each element bound, and then remove the event handler. If for some reason that doesn’t fulfill the requirements, one could also disable the button entirely after it has been clicked. $(document).ready(function () { $(“#submit”).one(‘click’, function (event) { event.preventDefault(); //do something $(this).prop(‘disabled’, true); }); }); It … Read more