show JavaFX Error Popup - Java JavaFX

Java examples for JavaFX:Dialog

Description

show JavaFX Error Popup

Demo Code


import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;

public class Main{
    public static void showErrorPopup(String message) {
        Alert alert = new Alert(AlertType.ERROR);
        alert.setTitle("Error");
        alert.setHeaderText("An error has occured");
        alert.setContentText(message);//ww  w . j  a  va2s  .  co  m

        alert.showAndWait();
    }
}

Related Tutorials