show JavaFX Alert Dialog - Java JavaFX

Java examples for JavaFX:Dialog

Description

show JavaFX Alert Dialog

Demo Code


import java.io.InputStream;
import java.util.logging.Logger;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.text.Font;

public class Main{
    public static void showDialog(AlertType type, String title,
            String header, String message) {

        Alert alert = new Alert(type);
        alert.setHeaderText(header);//from   w w  w.ja  v a2  s  . c  om
        alert.setTitle(title);
        alert.setContentText(message);
        alert.showAndWait();

    }
}

Related Tutorials