-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertTask.java
More file actions
52 lines (37 loc) · 973 Bytes
/
Copy pathAlertTask.java
File metadata and controls
52 lines (37 loc) · 973 Bytes
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
51
52
package sample;
import javafx.concurrent.Task;
import javafx.scene.control.Alert;
/**
* @author liuxf
* @version 1.0
* @date 2020/12/10 10:35
*/
public class AlertTask extends Task {
private String content;
private Alert.AlertType alertType;
private String msg;
public AlertTask(Alert.AlertType alertType, String msg, String content) {
this.alertType = alertType;
this.msg = msg;
this.content = content;
}
public AlertTask() {
}
@Override
protected Object call() throws Exception {
return null;
}
@Override
protected void succeeded() {
Alert alert = new Alert(alertType);
if (alertType == Alert.AlertType.ERROR) {
alert.setTitle("Error Dialog");
} else {
alert.setTitle("info Dialog");
}
alert.setHeaderText(msg);
alert.setContentText(content);
alert.show();
super.succeeded();
}
}