show JavaFX Error Alert - Java JavaFX

Java examples for JavaFX:Alert

Description

show JavaFX Error Alert

Demo Code


import javafx.application.Platform;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;

public class Main{
    public static void main(String[] argv) throws Exception{
        String content = "java2s.com";
        showErrorAlert(content);/*from  w w  w  .  j a  v  a  2  s .c o m*/
    }
    public static void showErrorAlert(String content)
{
    Platform.runLater(() -> {
        Alert a = new Alert(Alert.AlertType.ERROR, content, ButtonType.OK);
        a.show();
    });
}
}

Related Tutorials