[英]center (subscene) of borderpane not resizing
I'm making an application that uses a SubScene instance on the BorderPane center, and on the right side i want to put a vbox with some content.我正在制作一个在 BorderPane 中心使用 SubScene 实例的应用程序,在右侧我想放置一个包含一些内容的 vbox。 The subscene starts with the correct size, and resizes perfectly when maximizing the window.子场景以正确的大小开始,并在最大化 window 时完美调整大小。 before maximizing , maximized最大化之前,最大化
The problem is, when minimizing the window this happens: minimized问题是,当最小化 window 时,会发生这种情况:最小化
What can I do?我能做些什么?
Here's how I managed the resizing system:以下是我管理调整大小系统的方式:
SubScene subScene = new SubScene(group, 1200, 700, true, SceneAntialiasing.BALANCED);
HBox centerBox = new HBox();
subScene.widthProperty().bind(centerBox.widthProperty());
subScene.heightProperty().bind(centerBox.heightProperty());
centerBox.getChildren().add(subScene);
For anyone with the same problem.对于任何有同样问题的人。 I solved it by binding the SubScene width and height properties with the scene's, and then subtracting the width(200) and height(75) of adjacent nodes:我通过将 SubScene 宽度和高度属性与场景绑定,然后减去相邻节点的宽度(200)和高度(75)来解决它:
// Scene scene = new Scene(root, 1200, 800, true);
// SubScene subScene = new SubScene(group, 1200, 700, true, SceneAntialiasing.BALANCED);
// centerBox is an instance of HBox
subScene.widthProperty().bind(scene.widthProperty().subtract(200));
subScene.heightProperty().bind(scene.heightProperty().subtract(75));
centerBox.getChildren().add(subScene);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.