show Error via JavaFX Alert - Java JavaFX

Java examples for JavaFX:Alert

Description

show Error via JavaFX Alert

Demo Code


import javafx.scene.control.Alert;
import java.util.Optional;

public class Main{
    public static void main(String[] argv) throws Exception{
        String title = "java2s.com";
        String header = "java2s.com";
        String message = "java2s.com";
        showError(title,header,message);
    }//from w  w w . j  ava2 s.  c  o  m
    public static void showError(String title, String header, String message) {
        Alert alert = new Alert(Alert.AlertType.ERROR);
        alert.setTitle(title);
        alert.setHeaderText(header);
        alert.setContentText(message);
        alert.showAndWait();
    }
}

Related Tutorials