在不知道包含节点的情况下从组中删除所有子项

时间:2014-11-21 16:57:58

标签: javafx javafx-8 javafx-2

检查出来

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

现在我的问题是如何删除这个" grid"来自" g"没有指定" grid" 喜欢这样的东西

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

提前致谢

1 个答案:

答案 0 :(得分:20)

如果要删除集合中的所有项目,请使用clear()方法:

g.getChildren().clear();