【问题标题】:JavaFX SubScene height sets to max height not to current height when resizing调整大小时,JavaFX SubScene 高度设置为最大高度而不是当前高度
【发布时间】:2018-11-13 18:05:47
【问题描述】:

我在 StackPane 中放置了一个要正确调整大小的 SubScene。宽度调整效果完美。但是,高度设置为最大值,并且在窗口缩小时不会缩小。如何强制高度保持实际窗口高度而不是最大值?

view.fxml:

<StackPane fx:id="MapPane"/>

Controller.java:

MapPane.getChildren().clear();
MapPane.getChildren().add(mapScene);
mapScene.setManaged(false);
                        mapScene.heightProperty().bind(MapPane.heightProperty());
mapScene.widthProperty().bind(MapPane.widthProperty());

【问题讨论】:

    标签: javafx javafx-8 fxml


    【解决方案1】:

    事实证明,子场景 fxml 代码阻止了在 &lt;BorderPane&gt; 行中缩小视图。 故障线路:

    <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity">
    

    正确的行:

    <BorderPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="0" minWidth="0">
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-06-21
      • 2016-03-30
      • 1970-01-01
      • 2021-05-17
      • 2019-02-03
      • 1970-01-01
      • 2013-04-28
      • 2017-12-08
      相关资源
      最近更新 更多