带换行文本的javafx gridpane布局

带换行文本的javafx gridpane布局,java,javafx,Java,Javafx,我在JavaFX8工作。尝试使用GridPage显示一组属性和值。有些值可能足够长,无法放在一行中。我想包装这些值,但似乎不知道如何使网格窗格垂直展开以容纳包装的文本。我基本上希望看到HTML表中的行为。不确定我应该使用的JavaFX中是否有不同的布局 Property A Value A Property B Value B Property C The Values for property C is so long that it wraps

我在JavaFX8工作。尝试使用GridPage显示一组属性和值。有些值可能足够长,无法放在一行中。我想包装这些值,但似乎不知道如何使网格窗格垂直展开以容纳包装的文本。我基本上希望看到HTML表中的行为。不确定我应该使用的JavaFX中是否有不同的布局

Property A    Value A
Property B    Value B
Property C    The Values for property C is so long
              that it wraps
Property D    Value D
感谢您提供的任何帮助

使用以下方法构建:



您可以发布一些代码来显示您是如何设置的吗?通过设置VGrow并使用
TextFlow
可以轻松实现这一点。正如James_D所说,如果你展示一下你目前拥有的/你尝试过的,这会很有帮助。谢谢你的工作示例,这就足够了。我在行约束上使用了prefHeight属性来指定适当的间距,这导致文本无法换行。现在看来很明显。
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>

<VBox prefWidth="220.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
   <children>
      <GridPane hgap="20.0" vgap="10.0">
        <columnConstraints>
          <ColumnConstraints hgrow="SOMETIMES" maxWidth="-Infinity" minWidth="-Infinity" />
          <ColumnConstraints hgrow="SOMETIMES" maxWidth="1.7976931348623157E308" minWidth="20.0" />
        </columnConstraints>
        <rowConstraints>
          <RowConstraints minHeight="-Infinity" valignment="TOP" vgrow="SOMETIMES" />
          <RowConstraints minHeight="-Infinity" valignment="TOP" vgrow="SOMETIMES" />
          <RowConstraints minHeight="-Infinity" valignment="TOP" vgrow="SOMETIMES" />
        </rowConstraints>
         <children>
            <Label text="Property A" />
            <Label text="Property B" GridPane.rowIndex="1" />
            <Label text="Property C" GridPane.rowIndex="2" />
            <Label text="Value A" GridPane.columnIndex="1" />
            <Label text="The value for property B is so long that it wraps" wrapText="true" GridPane.columnIndex="1" GridPane.rowIndex="1" />
            <Label text="Value C" GridPane.columnIndex="1" GridPane.rowIndex="2" />
         </children>
         <padding>
            <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
         </padding>
      </GridPane>
   </children>
</VBox>