I'm currently playing with Netbeans 7.0 and JavaFX 2.0-beta (Java 1.6.0_26, OS Windows XP) and noticed, that the onMouseClicked event handler doesn't seem to work properly.
I added one to the scene but it got triggered only very sporadical, when I hit the mouse button several times really fast. The onMousePressed and onMouseReleased handlers on the other side work as expected.
I also tried adding a click event handler to other nodes like a Rectangle or a Pane but it's always the same behaviour.
Is this a (known) bug or limitation of the beta release or am I missing something here?
Here is a a short example:
public void start(Stage primaryStage) {
primaryStage.setTitle("JavaFX");
final BorderPane root = new BorderPane();
final Scene scene = new Scene(root, 800, 600, Color.BLACK);
scene.setOnMouseClicked(new EventHandler<MouseEvent>() {
public void handle(MouseEvent event) {
System.out.println("click");
}
});
primaryStage.setScene(scene);
primaryStage.centerOnScreen();
primaryStage.setVisible(true);
}
Regards,
Kai
Edited by: 865264 on 11.06.2011 13:29 (thanks for the tip, Darryl)