Double clicks are being captured as single click :(
In fxml file:
<Button fx:id="A_button" onMouseClicked="#buttonAClicked">
In the controller
private void buttonAClicked(MouseEvent mouseEvent) {
if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
if (mouseEvent.getClickCount() == 2) {
System.out.println("Double clicked A_button");
}
if (mouseEvent.getClickCount() == 1) {
System.out.println("Single clicked A_button");
}
}
}
Unfortunately I am finding that double click is not being caught - only single clicks. In the debugger, click count is 1.
Update: Since I cant figure out why it is not working for me on JavaFX 2.2.3-b05, I did a workaround and removed the need for double-click. I added a "Load" button to the UI. Now user must single click AND press the load button.