2
我有一個右邊的TiteldPane的垂直尺寸有問題(見下圖)。兩個TitledPanes都放在一個GridPane中。我希望較小的一個像左邊那樣得到相同的高度。我試圖將Vgrow設置爲正確的TitledPane的「始終」,但沒有發生任何事情。此外,我試圖與一個地區做一些事情沒有成功。這可能沒有給他們一個絕對的高度?如何在Gridpane中獲得相同的TitledPanes垂直尺寸? (JavaFX,Scenebuilder)
感謝您的幫助提前。
<?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>
謝謝你,工作正常。我只需將標題面板的網格面板放入一個安裝面板即可放置好。 – Gero