在javafx中清除HBox



我正在尝试从其项目中清除HBox。我试过使用hBox.getChildren().clear(),甚至循环

for(Node child: hBox.getChildren()){
    hBox.getChildren().remove(child);
}

但两者都不起作用。有什么想法吗?

删除版本将为您提供一个 ConcurrentModificationException - 清除应该可以正常工作 - 至少它对我有用

最新更新