Package it.univr.wordautomata.alerts
Class Alerts
java.lang.Object
it.univr.wordautomata.alerts.Alerts
The Alerts class provides utility methods for displaying different types of
alert dialogs.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.scene.control.Alert
createAlert
(javafx.scene.control.Alert.AlertType type, javafx.scene.Scene scene, String title, String header, String body, javafx.scene.control.ButtonType... buttons) Creates an alert dialog with the specified type, scene, title, header, body, and buttons.static boolean
showConfirmationDialog
(javafx.scene.Scene scene, String title, String body) Displays a confirmation dialog with the specified title and body.static void
showErrorDialog
(javafx.scene.Scene scene, String title, String body, boolean showAndWait) Displays an error dialog with the specified title and body.static void
showErrorDialog
(javafx.scene.Scene scene, String title, String header, String body, boolean showAndWait) Displays an error dialog with the specified title, header, and body.static void
showInformationDialog
(javafx.scene.Scene scene, String title, String body) Displays an information dialog with the specified title and body.static void
showInformationDialog
(javafx.scene.Scene scene, String title, String header, String body) Displays an information dialog with the specified title, header, and body.
-
Constructor Details
-
Alerts
public Alerts()
-
-
Method Details
-
showConfirmationDialog
Displays a confirmation dialog with the specified title and body.- Parameters:
scene
- the scene to which the dialog belongstitle
- the title of the dialogbody
- the body text of the dialog- Returns:
- true if the user clicks the "Yes" button, false otherwise
-
showInformationDialog
Displays an information dialog with the specified title and body.- Parameters:
scene
- the scene to which the dialog belongstitle
- the title of the dialogbody
- the body text of the dialog
-
showInformationDialog
public static void showInformationDialog(javafx.scene.Scene scene, String title, String header, String body) Displays an information dialog with the specified title, header, and body.- Parameters:
scene
- the scene to which the dialog belongstitle
- the title of the dialogheader
- the header text of the dialogbody
- the body text of the dialog
-
showErrorDialog
public static void showErrorDialog(javafx.scene.Scene scene, String title, String body, boolean showAndWait) Displays an error dialog with the specified title and body.- Parameters:
scene
- the scene to which the dialog belongstitle
- the title of the dialogbody
- the body text of the dialogshowAndWait
- true if the dialog should be shown and wait for user input, false otherwise
-
showErrorDialog
public static void showErrorDialog(javafx.scene.Scene scene, String title, String header, String body, boolean showAndWait) Displays an error dialog with the specified title, header, and body.- Parameters:
scene
- the scene to which the dialog belongstitle
- the title of the dialogheader
- the header text of the dialogbody
- the body text of the dialogshowAndWait
- true if the dialog should be shown and wait for user input, false otherwise
-
createAlert
public static javafx.scene.control.Alert createAlert(javafx.scene.control.Alert.AlertType type, javafx.scene.Scene scene, String title, String header, String body, javafx.scene.control.ButtonType... buttons) Creates an alert dialog with the specified type, scene, title, header, body, and buttons.- Parameters:
type
- the type of the alert dialogscene
- the scene to which the dialog belongstitle
- the title of the dialogheader
- the header text of the dialogbody
- the body text of the dialogbuttons
- the buttons to be displayed in the dialog- Returns:
- the created alert dialog
-