i have this issue with javaFX GUI ... i want when i press button i verify if there is no empty pane else i Add a new pane .. but every time i get ConcurrentModificationException . i have tried with print and i see that only the first section of for here is executed and not the other
enter code here
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
for (Node node : vbox.getChildren()) {
if (node instanceof Pane){
Pane pane = (Pane) node ;
if (pane.getChildren().isEmpty()){
vbox.getChildren().remove(node);
}
}``
}
drugrow drug = new drugrow();
vbox.getChildren().addAll(drug.getPane());
}
});