我正在尝试使用以下方法将FXML加载到现有的AnchorPane中:
@FXML
private AnchorPane content;
...
AnchorPane newPane = FXMLLoader.load(getClass().getResource("/fxml/scene2.fxml"));
this.content.getChildren().setAll(newPane);
一切都很好,但是它破坏了scene2.fxml的布局,因为它以首选的大小显示自己。我想让它动态地适应父FXML的大小(基本上具有scene1.fxml的AnchorPane的大小)。
我的代码有什么问题?错误在哪里?如何自动调整scene2.fxml的大小?
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句