【发布时间】:2018-03-19 10:35:27
【问题描述】:
我希望我的应用程序打开一个用户无法关闭的对话框,但是当他的手机重新连接时它会关闭(他对打开的对话框有耐心)
我目前正在使用 Platform.runlater 打开警报对话框,如下所示:
phoneConnected.getObservable().addListener(observable -> {
LOG.info("identifyObs " + phoneConnected.getBooleanDataValue().getValue());
if (phoneConnected.getBooleanDataValue() != null && !phoneConnected.getBooleanDataValue().getValue()) {
Platform.runLater(() -> alert.show());
}
if (phoneConnected.getBooleanDataValue().getValue()) {
System.out.println("ok");
alert.close();
Platform.runLater(() -> alert.close());
}
});
事实是,当 observable 变为“true”时,我在控制台中得到了“ok”,但对话框没有关闭..
我在 runLater 中尝试过,在 runLater 中尝试过,有什么想法吗?
我想说,我见过这个:Javafx: Close alert box (or, any dialog box) programatically 但它不起作用..
【问题讨论】:
标签: javafx dialog javafx-8 observable