src/ui/dialog/Dialogs.java
/*
     * Show a dialog window with the given node as the root node, and perform
     * the given action when the dialog is shown.
     */
Show a dialog window with the given node as the root node, and perform
the given action when the dialog is shown.
Show a dialog window with the given node as the root node and perform the given action when the dialog is shown .
private static void showDialog(Parent root, final OnShownAction onShown) {
        final Stage dialog = new Stage(StageStyle.UNDECORATED);
        dialog.initModality(Modality.WINDOW_MODAL);
        final Window owner = Model.getInstance().getMainWindow();
        dialog.initOwner(owner);
        dialog.setScene(new Scene(root));
        dialog.setOnShown(new EventHandler<WindowEvent>() {
            @Override
            public void handle(WindowEvent t) {
                dialog.setX(owner.getX() + owner.getWidth() / 2 - dialog.getWidth() / 2);
                dialog.setY(owner.getY() + owner.getHeight() / 2 - dialog.getHeight() / 2);
                if (onShown != null) {
                    onShown.perform();
                }
            }
        });
        FadeTransitionBuilder.create()
                .node(owner.getScene().getRoot())
                .toValue(0.25)
                .build()
                .play();
        dialog.showAndWait();
        FadeTransitionBuilder.create()
                .node(owner.getScene().getRoot())
                .toValue(1)
                .build()
                .play();
    }
private static void showDialog ( Parent root , final OnShownAction onShown ) { final Stage dialog = new Stage ( StageStyle . UNDECORATED ) ; dialog . initModality ( Modality . WINDOW_MODAL ) ; final Window owner = Model . getInstance ( ) . getMainWindow ( ) ; dialog . initOwner ( owner ) ; dialog . setScene ( new Scene ( root ) ) ; dialog . setOnShown ( new EventHandler < WindowEvent > ( ) { @ Override public void handle ( WindowEvent t ) { dialog . setX ( owner . getX ( ) + owner . getWidth ( ) / 2 - dialog . getWidth ( ) / 2 ) ; dialog . setY ( owner . getY ( ) + owner . getHeight ( ) / 2 - dialog . getHeight ( ) / 2 ) ; if ( onShown != null ) { onShown . perform ( ) ; } } } ) ; FadeTransitionBuilder . create ( ) . node ( owner . getScene ( ) . getRoot ( ) ) . toValue ( 0.25 ) . build ( ) . play ( ) ; dialog . showAndWait ( ) ; FadeTransitionBuilder . create ( ) . node ( owner . getScene ( ) . getRoot ( ) ) . toValue ( 1 ) . build ( ) . play ( ) ; }
Show a dialog window with the given node as the root node, and perform
 the given action when the dialog is shown.
Show a dialog window with the given node as the root node and perform the given action when the dialog is shown .
// Create an undecorated modal stage, with the main window as its owner, // and the given root as its content // Center the dialog within the main window. // Perform the optional callback. // Fade out the main window, show the dialog, wait for it the closed, // then fade the main window back in.