Asperger Asperger - 2 months ago 25
Java Question

FXML set percentWidth on target node directly

Is it possible to set the percentWidth in the target node directly? I tried but im getting many errors if I do so:

<GridPane>
<Button fx:id="node" id="node" text="fooBar"
GridPane.columnIndex="1" GridPane.hgrow="always" GridPane.percentWidth="25"/>
</GridPane>


that is instead of:

<columnConstraints>
<ColumnConstraints percentWidth="25" />
</columnConstraints>

Answer

No. There is no static setPercentWidth(Node, ...) method in GridPane (see docs).

It wouldn't really make sense to allow this anyway; it would enable you to set different percent widths on different nodes even if they were in the same column. Percent width is inherently a property of a column.

Comments