Example usage for javafx.scene.control Dialog initModality

List of usage examples for javafx.scene.control Dialog initModality

Introduction

In this page you can find the example usage for javafx.scene.control Dialog initModality.

Prototype

public final void initModality(Modality modality) 

Source Link

Document

Specifies the modality for this dialog.

Usage

From source file:jlotoprint.MainViewController.java

public static void loadAboutWindow() {

    //setup//from www . jav a 2  s .  c om
    Dialog dialog = new Dialog<>();
    dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
    dialog.setTitle("About JLotoPanel");
    dialog.setHeaderText("JLotoPanel v1.0");
    ImageView icon = new ImageView("file:resources/icon.png");
    icon.setSmooth(true);
    icon.setFitHeight(48.0);
    icon.setFitWidth(48.0);
    dialog.setGraphic(icon);
    dialog.initModality(Modality.APPLICATION_MODAL);
    dialog.initOwner(JLotoPrint.stage.getScene().getWindow());
    //content
    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 0, 10));

    //text
    TextArea textArea = new TextArea("For more info, please visit: https://github.com/mbppower/JLotoPanel");
    textArea.setWrapText(true);
    grid.add(textArea, 0, 0);
    dialog.getDialogPane().setContent(grid);

    dialog.showAndWait();
}