java - 边框的中心(子场景)未调整大小
问题描述
我正在制作一个在 BorderPane 中心使用 SubScene 实例的应用程序,在右侧我想放置一个包含一些内容的 vbox。子场景以正确的大小开始,并在最大化窗口时完美调整大小。最大化之前,最大化
问题是,当最小化窗口时会发生这种情况: 最小化
我能做些什么?
以下是我管理调整大小系统的方式:
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);
推荐阅读
- javascript - Cordova 未定义 加载后 file:///android_assets/file.html
- react-native - React Native fetch 返回 404 但邮递员执行 200 ok
- c++ - 解释 C++ 中的指针传递?
- c# - 使用 iTextSharp 生成的 pdf 中没有水平滚动条
- c# - 制作对象的整数列表
- python - odoo13中res.partner和res.user是什么关系?
- r - 如何在 Rstudio 中为新会话设置默认工作文件夹?
- node.js - 为什么 child_process.spawn 会阻止父级退出?
- android - 开发 SDK 时的架构清晰
- shell - 循环通过文件外壳脚本时 ed 不起作用