Interface AlertFactory
public interface AlertFactory
Used to create an alert with the given parameters
Don't implement this interface
Just use the static methods
Don't implement this interface
Just use the static methods
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addExceptionStackTrace
(javafx.scene.control.Alert target, Exception e) To add the stack trace of an exception the target alertstatic @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 alerttitle
- the title of the alert (can be null)header
- the header of the alertcontent
- the content of the alertbuttons
- the buttons of the alert, default is OK- Returns:
- the alert
-
addExceptionStackTrace
To add the stack trace of an exception the target alert- Parameters:
target
- the target alert
the alert type must beAlert.AlertType.ERROR
otherwise, do nothinge
- 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"
-