Remove all children from a group without knowing the containing nodes


Question

check this out

 Group g = new Group();
 GridPane grid = new GridPane(); // 
 g.getChildren().addAll(grid);

now my question is how do i remove this "grid" from "g" without specifying "grid" like something like this

g.getChildren().removeAll(null); //i do not know what to insert here?

thanks in advance

1
11
2/1/2019 11:37:25 AM

Accepted Answer

If you want to remove all items from a collection, use the clear() method:

g.getChildren().clear();
21
11/21/2014 5:00:17 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon