Skip to content
Advertisement

How to match parent AnchorPane to HBox in javafx

I am using JavaFX and I have HBox parent and AnchorPane child, so when I resize the parent, the child doesn’t resize, I wanna make the AnchorPane fill the parent (like match_parent in android).

Answer

You should set HGrow = ALWAYS in the AnchorPane.

<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" HBox.hgrow="ALWAYS" />
Advertisement