run this code and set focus to the combobox and click space - not effects.
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
ComboBox box = new ComboBox<>();
box.getItems().setAll("First", "Second");
VBox root = new VBox();
root.getChildren().addAll(btn, box);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
ComboBox box = new ComboBox<>();
box.getItems().setAll("First", "Second");
VBox root = new VBox();
root.getChildren().addAll(btn, box);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}