[英]center (subscene) of borderpane not resizing
我正在制作一個在 BorderPane 中心使用 SubScene 實例的應用程序,在右側我想放置一個包含一些內容的 vbox。 子場景以正確的大小開始,並在最大化 window 時完美調整大小。 最大化之前,最大化
問題是,當最小化 window 時,會發生這種情況:最小化
我能做些什么?
以下是我管理調整大小系統的方式:
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);
對於任何有同樣問題的人。 我通過將 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.