FXUIUtils.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:marathonv5 作者:
@SuppressWarnings("unchecked") public static Optional<ButtonType> showConfirmDialog(Window parent, String message, String title,
        AlertType type, ButtonType... buttonTypes) {
    if (Platform.isFxApplicationThread()) {
        return _showConfirmDialog(parent, message, title, type, buttonTypes);
    } else {
        Object r[] = { null };
        Object lock = new Object();
        synchronized (lock) {
            Platform.runLater(() -> {
                r[0] = _showConfirmDialog(parent, message, title, type, buttonTypes);
                synchronized (lock) {
                    lock.notifyAll();
                }
            });
        }
        synchronized (lock) {
            try {
                lock.wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        return (Optional<ButtonType>) r[0];
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号