Example usage for javafx.scene.control Button defaultButtonProperty

List of usage examples for javafx.scene.control Button defaultButtonProperty

Introduction

In this page you can find the example usage for javafx.scene.control Button defaultButtonProperty.

Prototype

public final BooleanProperty defaultButtonProperty() 

Source Link

Usage

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();
        }
    });
}