Java Code Examples for javafx.scene.control.Button.setCancelButton()

The following are Jave code examples for showing how to use setCancelButton() of the javafx.scene.control.Button class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Dr-Assistant   File: PrescriptionAction.java   Source Code and License Vote up 6 votes
public PrescriptionAction() {

        button = new Button();
        button0 = new Button();

        setSpacing(3.0);
        setStyle("-fx-background-color: none;");
        getStylesheets().add("/view/common/../../css/main.css");

        button.setDefaultButton(true);
        button.setMnemonicParsing(false);
        button.setOnAction(this::handleEditButton);
        button.setText("Edit");

        button0.setCancelButton(true);
        button0.setMnemonicParsing(false);
        button0.setOnAction(this::handleDeleteButton);
        button0.setText("Delete");

        getChildren().add(button);
        getChildren().add(button0);

    }
 
Example 2
Project: CalendarFX   File: RecurrencePopupSkin.java   Source Code and License Vote up 5 votes
public RecurrencePopupSkin(RecurrencePopup popup) {
    super();

    this.popup = popup;

    Button okButton = new Button(Messages.getString("RecurrencePopupSkin.OK")); //$NON-NLS-1$
    okButton.setDefaultButton(true);
    okButton.setOnAction(evt -> {
        popup.hide();
        popup.fireEvent(
                new RecurrencePopupEvent(RecurrencePopupEvent.OK_PRESSED));
    });

    Button cancelButton = new Button(Messages.getString("RecurrencePopupSkin.CANCEL")); //$NON-NLS-1$
    cancelButton.setCancelButton(true);
    cancelButton.setOnAction(evt -> {
        popup.hide();
        popup.fireEvent(
                new RecurrencePopupEvent(RecurrencePopupEvent.CANCEL_PRESSED));
    });

    HBox buttonBox = new HBox();
    buttonBox.setAlignment(Pos.CENTER);
    buttonBox.getChildren().addAll(cancelButton, okButton);
    buttonBox.getStyleClass().add("button-pane"); //$NON-NLS-1$

    BorderPane contentPane = new BorderPane();
    contentPane.getStyleClass().add("content"); //$NON-NLS-1$
    contentPane.setCenter(popup.getRecurrenceView());
    contentPane.setBottom(buttonBox);

    stackPane = popup.getRoot();
    stackPane.getChildren().add(contentPane);
}
 
Example 3
Project: Dr-Assistant   File: Actions.java   Source Code and License Vote up 4 votes
public Actions() {

        columnConstraints = new ColumnConstraints();
        columnConstraints0 = new ColumnConstraints();
        columnConstraints1 = new ColumnConstraints();
        rowConstraints = new RowConstraints();
        button = new Button();
        button0 = new Button();
        button1 = new Button();

        setPrefHeight(32.0);
        setPrefWidth(186.0);
        setStyle("-fx-background-color: none;");
        getStylesheets().add("/view/common/../../css/main.css");

        columnConstraints.setHgrow(javafx.scene.layout.Priority.SOMETIMES);
        columnConstraints.setMaxWidth(120.0);
        columnConstraints.setMinWidth(10.0);
        columnConstraints.setPrefWidth(95.0);

        columnConstraints0.setHgrow(javafx.scene.layout.Priority.SOMETIMES);
        columnConstraints0.setMaxWidth(150.0);
        columnConstraints0.setMinWidth(10.0);
        columnConstraints0.setPrefWidth(100.0);

        columnConstraints1.setHgrow(javafx.scene.layout.Priority.SOMETIMES);
        columnConstraints1.setMaxWidth(192.0);
        columnConstraints1.setMinWidth(10.0);
        columnConstraints1.setPrefWidth(110.0);

        rowConstraints.setMinHeight(10.0);
        rowConstraints.setPrefHeight(30.0);
        rowConstraints.setVgrow(javafx.scene.layout.Priority.SOMETIMES);

        button.setDefaultButton(true);
        button.setMnemonicParsing(false);
        button.setOnAction(this::handleEditButton);
        button.setText("Edit");

        GridPane.setColumnIndex(button0, 1);
        button0.setMnemonicParsing(false);
        button0.setOnAction(this::handleViewButton);
        button0.getStyleClass().add("btn-primary");
        button0.setText("View");

        GridPane.setColumnIndex(button1, 2);
        button1.setCancelButton(true);
        button1.setMnemonicParsing(false);
        button1.setOnAction(this::handleDeleteButton);
        button1.setText("Delete");

        getColumnConstraints().add(columnConstraints);
        getColumnConstraints().add(columnConstraints0);
        getColumnConstraints().add(columnConstraints1);
        getRowConstraints().add(rowConstraints);
        getChildren().add(button);
        getChildren().add(button0);
        getChildren().add(button1);

    }