List of usage examples for javafx.scene.control Button defaultButtonProperty
public final BooleanProperty defaultButtonProperty()
From source file:eu.ggnet.dwoss.util.OkCancelStage.java
public OkCancelStage(String title, T payload) { this.payload = payload; BorderPane pane = new BorderPane(); pane.setCenter(payload);//from ww w . jav a 2s. c om Button okButton = new Button("Ok"); okButton.defaultButtonProperty(); Button cancelButton = new Button("Abbrechen"); cancelButton.setCancelButton(true); HBox bottom = new HBox(); bottom.setPadding(new Insets(10)); bottom.getChildren().addAll(okButton, cancelButton); pane.setBottom(bottom); if (!StringUtils.isBlank(title)) setTitle(title); setScene(new Scene(pane)); okButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { OkCancelStage.this.ok = true; close(); } }); cancelButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { close(); } }); }