|
|
@ -86,6 +86,8 @@ public class Dialog {
|
|
|
|
|
|
|
|
|
|
|
|
public static void showConfirmDialog(String message) {
|
|
|
|
public static void showConfirmDialog(String message) {
|
|
|
|
popup = new Stage();
|
|
|
|
popup = new Stage();
|
|
|
|
|
|
|
|
popup.setWidth(200);
|
|
|
|
|
|
|
|
popup.setHeight(160);
|
|
|
|
popup.setAlwaysOnTop(true);
|
|
|
|
popup.setAlwaysOnTop(true);
|
|
|
|
popup.initModality(Modality.APPLICATION_MODAL);
|
|
|
|
popup.initModality(Modality.APPLICATION_MODAL);
|
|
|
|
final Button closeBtn = new Button("确认");
|
|
|
|
final Button closeBtn = new Button("确认");
|
|
|
@ -108,6 +110,33 @@ public class Dialog {
|
|
|
|
popup.show();
|
|
|
|
popup.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void showConfirmDialog(String message, EventHandler handler) {
|
|
|
|
|
|
|
|
popup = new Stage();
|
|
|
|
|
|
|
|
popup.setAlwaysOnTop(true);
|
|
|
|
|
|
|
|
popup.setWidth(200);
|
|
|
|
|
|
|
|
popup.setHeight(160);
|
|
|
|
|
|
|
|
popup.initModality(Modality.APPLICATION_MODAL);
|
|
|
|
|
|
|
|
final Button okBtn = new Button("确认");
|
|
|
|
|
|
|
|
okBtn.setOnAction(new EventHandler<ActionEvent>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void handle(ActionEvent event) {
|
|
|
|
|
|
|
|
popup.close();
|
|
|
|
|
|
|
|
handler.handle(event);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VBox root = new VBox();
|
|
|
|
|
|
|
|
root.setPadding(new Insets(20));
|
|
|
|
|
|
|
|
root.setAlignment(Pos.BASELINE_CENTER);
|
|
|
|
|
|
|
|
root.setSpacing(20);
|
|
|
|
|
|
|
|
Label label = new Label(message);
|
|
|
|
|
|
|
|
root.getChildren().addAll(label, okBtn);
|
|
|
|
|
|
|
|
Scene scene = new Scene(root);
|
|
|
|
|
|
|
|
popup.setScene(scene);
|
|
|
|
|
|
|
|
popup.setTitle("提示信息");
|
|
|
|
|
|
|
|
popup.show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void showError(String message) {
|
|
|
|
public static void showError(String message) {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
Platform.runLater(new Runnable() {
|
|
|
|
public void run() {
|
|
|
|
public void run() {
|
|
|
|