Interface AlertFactory


public interface AlertFactory
Used to create an alert with the given parameters
Don't implement this interface
Just use the static methods
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static void
    addExceptionStackTrace(javafx.scene.control.Alert target, Exception e)
    To add the stack trace of an exception the target alert
    static @NotNull javafx.scene.control.Alert
    createAlert(javafx.scene.control.Alert.AlertType type, @Nullable String title, String header, String content, @Nullable javafx.scene.control.ButtonType... buttons)
    Create an alert with the given parameters
  • Method Details

    • createAlert

      @NotNull static @NotNull javafx.scene.control.Alert createAlert(javafx.scene.control.Alert.AlertType type, @Nullable @Nullable String title, String header, String content, @Nullable @Nullable javafx.scene.control.ButtonType... buttons)
      Create an alert with the given parameters
      Parameters:
      type - the type of alert
      title - the title of the alert (can be null)
      header - the header of the alert
      content - the content of the alert
      buttons - the buttons of the alert, default is OK
      Returns:
      the alert
    • addExceptionStackTrace

      static void addExceptionStackTrace(javafx.scene.control.Alert target, Exception e)
      To add the stack trace of an exception the target alert
      Parameters:
      target - the target alert
      the alert type must be Alert.AlertType.ERROR
      otherwise, do nothing
      e - the exception
      the stack trace of the exception will be added to the target alert
      the stack trace will be shown in a scroll pane
      the text color will be red
      the text will be formatted like this:
      e.getMessage() + "\r\n" + e.getStackTrace().toString() + "\r\n"