Big label in the button makes FlowPane grow

96 Views Asked by At

I made Button with max width of 300 and input a long text in it. Button got max size, but FlowPane, which also has max size of 300, grew in width. How comes that Button text is affecting FlowPane width? How to prevent it from happening?
Screenshot:

FlowPane is marked with yellow border.

Button settings:

enter image description here

FlowPane settings:

enter image description here

1

There are 1 best solutions below

2
On BEST ANSWER

Place the FlowPane inside an AnchorPane. Set the AnchorPane sizes to the FlowPane sizes. At the very least, set the left and right AnchorPane constraints of the FlowPane to 0.

enter image description here

Is FlowPane really the Node you want here?