如何在 Gridpane 中获得相同垂直大小的 TitledPanes? (JavaFX,场景生成器)

How to get same vertical size of TitledPanes in a Gridpane? (JavaFX, Scenebuilder)

我对右侧 TiteldPane 的垂直尺寸有疑问(见下图)。两个 TitledPanes 都放在 GridPane 中。我希望较小的那个与左边的高度相同。我试图将 Vgrow 设置为右侧 TitledPane 的 "always",但没有任何反应。我也尝试用一个区域做某事但没有成功。如果不给他们一个绝对高度,这可能吗?

提前感谢您的帮助。

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TitledPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>

<AnchorPane xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <ScrollPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
        <content>
          <AnchorPane>
               <children>
                  <GridPane hgap="20.0" vgap="20.0">
                    <columnConstraints>
                      <ColumnConstraints hgrow="SOMETIMES" />
                      <ColumnConstraints hgrow="SOMETIMES" />
                    </columnConstraints>
                    <rowConstraints>
                      <RowConstraints valignment="TOP" vgrow="ALWAYS" />
                    </rowConstraints>
                     <padding>
                        <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
                     </padding>
                     <children>
                        <TitledPane animated="false" text="TitledPane">
                           <content>
                              <GridPane hgap="10.0" vgap="5.0">
                                <columnConstraints>
                                  <ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
                                  <ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
                                </columnConstraints>
                                <rowConstraints>
                                  <RowConstraints vgrow="SOMETIMES" />
                                  <RowConstraints vgrow="SOMETIMES" />
                                  <RowConstraints vgrow="SOMETIMES" />
                                    <RowConstraints vgrow="SOMETIMES" />
                                    <RowConstraints vgrow="SOMETIMES" />
                                    <RowConstraints vgrow="SOMETIMES" />
                                    <RowConstraints vgrow="SOMETIMES" />
                                </rowConstraints>
                                 <children>
                                    <Label text="Label" GridPane.halignment="RIGHT" />
                                    <Label GridPane.columnIndex="1" GridPane.rowIndex="1" />
                                    <Label text="Label" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
                                    <Label GridPane.columnIndex="1" GridPane.rowIndex="3" />
                                    <Label text="Label" GridPane.halignment="RIGHT" GridPane.rowIndex="4" />
                                    <Label GridPane.columnIndex="1" GridPane.rowIndex="5" />
                                    <TextField GridPane.columnIndex="1" />
                                    <TextField GridPane.columnIndex="1" GridPane.rowIndex="2" />
                                    <TextField fx:id="abgar10TF" GridPane.columnIndex="1" GridPane.rowIndex="4" />
                                 </children>
                              </GridPane>
                           </content>
                        </TitledPane>
                        <TitledPane animated="false" text="TitledPane" GridPane.columnIndex="1" GridPane.valignment="TOP" GridPane.vgrow="ALWAYS">
                           <content>
                              <GridPane hgap="10.0" vgap="5.0">
                                <columnConstraints>
                                  <ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
                                  <ColumnConstraints hgrow="SOMETIMES" minWidth="100.0" />
                                </columnConstraints>
                                <rowConstraints>
                                  <RowConstraints vgrow="SOMETIMES" />
                                  <RowConstraints vgrow="SOMETIMES" />
                                  <RowConstraints vgrow="SOMETIMES" />
                                    <RowConstraints vgrow="SOMETIMES" />
                                </rowConstraints>
                                 <children>
                                    <Label text="Label" GridPane.halignment="RIGHT" />
                                    <Label GridPane.columnIndex="1" GridPane.rowIndex="1" />
                                    <Label text="Label" GridPane.halignment="RIGHT" GridPane.rowIndex="2" />
                                    <Label GridPane.columnIndex="1" GridPane.rowIndex="3" />
                                    <TextField GridPane.columnIndex="1" />
                                    <TextField GridPane.columnIndex="1" GridPane.rowIndex="2" />
                                 </children>
                              </GridPane>
                           </content>
                        </TitledPane>
                     </children>
                  </GridPane>
               </children>
            </AnchorPane>
        </content>
      </ScrollPane>
   </children>
</AnchorPane>

您必须将两个 TitlePanes 的最大高度设置为 MAX_VALUE