Clearing an HBox in javafx

melkhaldi picture melkhaldi · Feb 16, 2014 · Viewed 9.3k times · Source

I am trying to clear an HBox from its items. I tried using hBox.getChildren().clear(), and even looping

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

but neither one works. Any ideas?

Answer

tomsontom picture tomsontom · Feb 16, 2014

The remove version will give you a ConcurrentModificationException - clear should just work - at least it works for me