Asperger Asperger - 1 year ago 118
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:

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

that is instead of:

<ColumnConstraints percentWidth="25" />

Answer Source

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.