Skip to content
Advertisement

GridPane: How to position a Label top-left?

How can I position the Label Label 1 at the top-left position of the cell? I tried to set the alignment of the label accordingly, but this didn’t do the trick.

enter image description here

JavaScript

d

Advertisement

Answer

You need to modify the first RowConstraints and set the valignment property to VPos.TOP.

The vertical alignment for the row. If set, will be the default vertical alignment for nodes contained within the row. If this property is set to VPos.BASELINE, then the fillHeight property will be ignored and nodes will always be resized to their preferred heights (docs).

Like this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement