I need to design a java application using javaFx. In the fxml there is two hBoxes; one filled with text fields and one filled with labels. Every text fields and label hGrow set to ALWAYS but text fields do grow horizontaly but labels wont.
Note that I know I can set a Pref Width to 999999 on all of them and they will behave as I want, but there has to be a more legit way.
Here is the fxml:
<VBox prefHeight="375.0" prefWidth="640.0">
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
<TextField promptText="ichi" HBox.hgrow="ALWAYS" />
<TextField promptText="ni " HBox.hgrow="ALWAYS" />
<TextField promptText="san " HBox.hgrow="ALWAYS" />
</HBox>
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
<Label text="eins" HBox.hgrow="ALWAYS" />
<Label text="zwei" HBox.hgrow="ALWAYS" />
<Label text="drei" HBox.hgrow="ALWAYS" />
</HBox>
</VBox>
As you can see all the hgrows set to ALYAWS but the results are like this:

Trying to fit all labels in to HBox with equal width distrubition. I figured a way but it is cheeky
Key Code:
Full code:
Output: