如何将ScrollPane的高度绑定到BorderPane的底部?

时间:2019-06-09 19:12:04

标签: java javafx fxml scrollpane

目前,我正在开发一个简单的游戏,在这里您有一个木板(MapView)和其他组件,例如聊天室,它们都有自己的MVP。

现在,我尝试将板子实现为ScrollPane,而无需通过拖动鼠标在板上移动。

问题是,当我调整窗口大小时,它隐藏了ScrollPane的一部分,并且在滚动时看不到其中的所有木板。

这是目标:

screenshot 1

这是当前正在发生的事情:

Screenshot 2


我已经尝试过监听器,重新排列此窗格,其他窗格等。

FXML:

<BorderPane fx:id="borderPane" stylesheets="@../style.css" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.172-ea">
    <top>
        <ToolBar>
            <Button fx:id="rulesButton" prefHeight="40.0" prefWidth="100.0" text="Rules"/>
            <Button fx:id="optionsButton" prefHeight="40.0" prefWidth="100.0" text="Options"/>
            <Button fx:id="exitButton" prefHeight="40.0" prefWidth="100.0" text="Exit"/>
            <HBox HBox.hgrow="ALWAYS"/>
            <ImageView fitHeight="100" fitWidth="100" pickOnBounds="true" preserveRatio="true">
                <Image url="@../neues_Logo.png"/>
            </ImageView>
        </ToolBar>
    </top>
    <center>
        <StackPane>
            <GridPane fx:id="gridPane">
                <Pane minWidth="3" GridPane.columnIndex="0"/>
                <Label fx:id="field" text="Field"
                       GridPane.columnIndex="1"
                       GridPane.rowIndex="0">
                    <font>
                        <Font name="System Bold" size="18.0"/>
                    </font>
                </Label>

                <ScrollPane fx:id="scrollPane" pannable="true"
                            maxWidth="1027" maxHeight="776" GridPane.rowIndex="1" GridPane.columnIndex="1">
                    <MapView fx:id="MapView" maxWidth="1027" maxHeight="776"/>
                </ScrollPane>

                <Pane minWidth="5" GridPane.columnIndex="2"/>
         </StackPane>
    </center>
</BorderPane>

其余的我使用MVP,目前仅与ScrollPane的连接是隐藏ScrollBar。

我希望解决方案非常明显,我现在看不到它,并且一直在寻找几个小时,浏览我在互联网上可以找到的所有内容。

0 个答案:

没有答案
相关问题