繁体   English   中英

边框的中心(子场景)未调整大小

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM