create JavaFX Dialog - Java JavaFX

Java examples for JavaFX:Dialog

Description

create JavaFX Dialog

Demo Code


//package com.java2s;

import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class Main {
    public static Stage createDialog(Node parentWindow, Parent node,
            String title) {//from   ww  w  . j  ava2s.co m
        Stage dialog = new Stage();
        dialog.initStyle(StageStyle.UTILITY);
        Scene scene = new Scene(node);
        dialog.setTitle(title);
        dialog.setScene(scene);
        dialog.initModality(Modality.WINDOW_MODAL);
        dialog.initOwner(parentWindow.getScene().getWindow());
        dialog.show();
        return dialog;
    }
}

Related Tutorials