我在GridPane
中添加了一些标签,发现长标签用省略号缩短了。虽然我希望很长的推动网格列宽度变得更宽,因为它发生在Swing中的MigLayout中。有可能吗?
答案 0 :(得分:0)
您正在寻找的功能是"总是"参数" hgrow"的值在columnconstraints中。检查以下代码以了解如何在fxml中使用此功能:
<GridPane xmlns:fx="http://javafx.com/fxml/1" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.40">
<columnConstraints>
<ColumnConstraints hgrow="ALWAYS" minWidth="10.0" prefWidth="100.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Label text="abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc" GridPane.rowIndex="1"/>
</children> </GridPane>
希望它有所帮助。