有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何将滚动窗格的高度绑定到边框窗格的底部?

我现在正在开发一个简单的游戏,其中有一个图板(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的唯一连接是隐藏滚动条

我希望解决方案是非常明显的,我只是现在看不到,已经找了好几个小时了,在互联网上找到了所有的东西


共 (0) 个答案