Using the source code below, the button's action is never fired in Windows - the alert is not displayed. Works fine on Mac OS X.
public class HelloButtonsJava extends Application {
@Override
public void start() {
Button btn = new Button("Button");
btn.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent actionEvent) {
Alert.inform("Button Clicked");
}
});
VBox vBox = new VBox();
vBox.setPadding(new Insets(10, 10, 10, 10));
vBox.getChildren().add(btn);
Scene scene = new Scene(vBox, 400, 400);
Stage stage = new Stage();
stage.setScene(scene);
stage.setVisible(true);
}
public static void main(String[] args) {
Launcher.launch(HelloButtons.class, args);
}
}
public class HelloButtonsJava extends Application {
@Override
public void start() {
Button btn = new Button("Button");
btn.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent actionEvent) {
Alert.inform("Button Clicked");
}
});
VBox vBox = new VBox();
vBox.setPadding(new Insets(10, 10, 10, 10));
vBox.getChildren().add(btn);
Scene scene = new Scene(vBox, 400, 400);
Stage stage = new Stage();
stage.setScene(scene);
stage.setVisible(true);
}
public static void main(String[] args) {
Launcher.launch(HelloButtons.class, args);
}
}
- duplicates
-
JDK-8100602 Need to remove existing Alert class
- Resolved
- is blocked by
-
JDK-8097791 Add javafx.scene.control.Alert class
- Resolved