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. The subscene starts with the correct size, and resizes perfectly when maximizing the window. before maximizing , maximized
The problem is, when minimizing the window this happens: minimized
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:
// 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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.