我尝试在JavaFX中显示警报对话框。
这是来源:
Platform.runLater(new Runnable() {
public void run() {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Confirmation dialog");
alert.setContentText("remove ?");
ButtonType btOk = new ButtonType("Yes");
ButtonType btCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(btOk, btCancel);
Optional<ButtonType> result = alert.showAndWait();
...
}
});
当我执行此源时,我有以下错误消息:
Exception in thread "JavaFX Application Thread" java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at com.sun.javafx.tk.quantum.GlassStage.windowsSetEnabled(GlassStage.java:166)
at com.sun.javafx.tk.quantum.WindowStage.setVisible(WindowStage.java:470)
at javafx.stage.Window$9.invalidated(Window.java:857)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
at javafx.stage.Window.setShowing(Window.java:910)
at javafx.stage.Window.show(Window.java:925)
at javafx.stage.Stage.show(Stage.java:259)
....
有什么想法吗?
有关信息,请使用此版本的JDK:8u60 ea-b13
提前谢谢你,
和Fabrice