List of usage examples for javafx.scene.control Button setOnMouseExited
public final void setOnMouseExited(EventHandler<? super MouseEvent> value)
From source file:Main.java
@Override public void start(Stage primaryStage) { Group root = new Group(); Scene scene = new Scene(root, 300, 250); Button btn = new Button(); btn.setText("Hello World"); btn.setOnMouseEntered(new EventHandler<MouseEvent>() { public void handle(MouseEvent me) { System.out.println("Mouse entered"); }//from ww w .j a v a 2 s . c o m }); btn.setOnMouseExited(new EventHandler<MouseEvent>() { public void handle(MouseEvent me) { System.out.println("Mouse exited"); } }); btn.setOnMousePressed(new EventHandler<MouseEvent>() { public void handle(MouseEvent me) { System.out.println("Mouse pressed"); } }); root.getChildren().add(btn); primaryStage.setScene(scene); primaryStage.show(); }