forked from MasterFlomaster1/JFXCrypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertDialog.java
More file actions
50 lines (41 loc) · 1.37 KB
/
Copy pathAlertDialog.java
File metadata and controls
50 lines (41 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package GUI.Main;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import java.util.Optional;
/**
* Add icons
*/
public class AlertDialog {
public static void showError(String error, String details) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText(error);
alert.setContentText(details);
alert.showAndWait();
}
public static void showError(String error) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText(error);
alert.showAndWait();
}
public static void showWarning(String warn) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Warning");
alert.setHeaderText(warn);
alert.showAndWait();
}
public static void showInfo(String info) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Info");
alert.setHeaderText(info);
alert.showAndWait();
}
public static boolean showConfirmDialog(String warn) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Warning");
alert.setHeaderText(warn);
Optional<ButtonType> option = alert.showAndWait();
return option.isPresent() && option.get() == ButtonType.OK;
}
}