java JavaFX - 如何从anchorPane 中清除所有节点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30008005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
JavaFX - How to clear all the nodes from an anchorPane
提问by Calips
I'm using sceneBuilder.
我正在使用场景构建器。
How to clear an AnchorPane ?
Is there a way to delete all the nodes contained in an AnchorPane (already created from sceneBuilder and populated with buttons and shapes) ?
如何清除 AnchorPane ?
有没有办法删除 AnchorPane 中包含的所有节点(已经从 sceneBuilder 创建并填充了按钮和形状)?
回答by Roland
The nodes of an AnchorPane are in a list. So you could do this:
AnchorPane 的节点在一个列表中。所以你可以这样做:
myPane.getChildren().clear();