javafx的fxml做实验:
<VBox alignment="CENTER" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"> 随窗体尺寸变化而适应
<children>
<Label text="Label" />
<HBox spacing="5.0"> hbox中的三个子控件label/passwordfiled/label的间距为5.0
<children>
<Label mnemonicParsing="false" text="leftg" wrapText="true" HBox.hgrow="SOMETIMES"> wraptext=true表示可以有多行显示 hbox.ghrow=sometimes表示窗体尺寸变化时在其它控件没有always(总是变化)变化之后的情况下,有多余的空间就跟随变化
<HBox.margin>
<Insets right="10.0" /> 这个label的外围与其它控件之间留有10.0的空隙间距
</HBox.margin></Label>
<PasswordField HBox.hgrow="ALWAYS" />当窗体尺寸变化时这个控件总是首先变化点有相应的空间
<Label alignment="CENTER_RIGHT" mnemonicParsing="false" text="right">
<HBox.margin>
<Insets bottom="0.0" left="0.0" right="1.0" top="0.0" />
</HBox.margin></Label>
</children>
</HBox>
</children>
</VBox>
来源:oschina
链接:https://my.oschina.net/u/2963604/blog/4299898