package dev.bytevibe.hyperpoint.Utils;

import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;

// 提示框,按钮设置为中文
public class MyAlert extends Alert {
    private static ButtonType confirm = new ButtonType("确定", ButtonBar.ButtonData.OK_DONE);
    private static ButtonType cancel  = new ButtonType("取消", ButtonBar.ButtonData.CANCEL_CLOSE);

    public MyAlert(Alert.AlertType alertType) {
        super(alertType);
        if (alertType == Alert.AlertType.CONFIRMATION) {
            getDialogPane().getButtonTypes().setAll(confirm, cancel);
        } else if (alertType == Alert.AlertType.INFORMATION || alertType == Alert.AlertType.WARNING || alertType == Alert.AlertType.ERROR) {
            getDialogPane().getButtonTypes().setAll(confirm);
        }
    }

    public static ButtonType isOK() {
        return confirm;
    }
}