Example usage for javafx.scene.control Dialog setGraphic

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

Introduction

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

Prototype

public final void setGraphic(Node graphic) 

Source Link

Document

Sets the dialog graphic, which will be displayed either in the header, if one is showing, or to the left of the DialogPane#contentProperty() content .

Usage

From source file:jlotoprint.MainViewController.java

public static void loadAboutWindow() {

    //setup// w w w.j  av  a  2 s .com
    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();
}