javafx HBox中三个控件位置实验

雨燕双飞 提交于 2020-07-29 11:35:30

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>

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!