javafx-2 – 为什么我的JavaFX HBox中的孩子不会成长(SceneBuilder)?

JavaFX docs for HBox说:

If an hbox is resized larger than its preferred width, by default it will keep children to their preferred widths, leaving the extra space unused. If an application wishes to have one or more children be allocated that extra space it may optionally set an hgrow constraint on the child. See “Optional Layout Constraints” for details.






见Oracle的Tips for Sizing and Aligning Nodes

UI controls also provide default minimum and maximum sizes that are based on the typical usage of the control. For example, the maximum size of a Button object defaults to its preferred size because you don’t usually want buttons to grow arbitrarily large.


To enable all of the buttons to be resized to the width of the VBox pane, the maximum width of each button is set to the Double.MAX_VALUE constant, which enables a control to grow without limit. An alternative to using the maximum value constant is to set the maximum width to a specific value, such as 80.0.

转载注明原文:javafx-2 – 为什么我的JavaFX HBox中的孩子不会成长(SceneBuilder)? - 代码日志