java - 如何固定边框节点?

标签 java javafx fxml borderpane

如 borderpane 的 javafx 文档所述 here ,

If the window is smaller than the space needed for the contents of each region, the regions might overlap. The overlap is determined by the order in which the regions are set. For example, if the regions are set in the order of left, bottom, and right, when the window is made smaller, the bottom region overlaps the left region and the right region overlaps the bottom region.

我有顶部和底部面板,它们是从 fxml 预定义的,中间面板由以编程方式更新的 ImageView 组成。我需要始终显示顶部和底部 Pane 。但是,当我调整应用程序窗口大小时,顶部 Pane 消失了。据我了解,这是因为中心 Pane 是最后更新的(根据文档)。如何设置此元素固定?我尝试在我的 fxml 文件中设置 minHeight="100.00",但这不起作用。

最佳答案

确保在 FXML 文件的中心之后定义顶部和底部区域:

<BorderPane>
  <center><!-- ... --></center>
  <top><!-- ... --></top>
  <bottom><!-- ... --></bottom>
</BorderPane>

关于java - 如何固定边框节点?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34735594/

相关文章:

java - 将ActionListener 添加到JMenuItem 时出错

java - 添加更多包后,Visual Studio 代码无法找到或加载主类

java - 从表格 View 中选择列

JavaFx-为什么滚动后表格 View 内的 ChoiceBox 值会重置

java - 如何将事件从子类发送到父类

java - 如何将变量值放入分区环境的步骤上下文中并在下一步中访问这些值。我为此使用 JSR 352

java - 使用 spring jpa 逐行获取数据库

将行拖动到视口(viewport)之外时,JavaFX 自动向上或向下滚动表

java - 使用 setOnAction 添加现有处理程序方法

java - 如何在具有两个场景的 JavaFXML Controller 中初始化圆形对象的双数组?