JavaFx之横向布局左右两侧对齐(十九)

JavaFx之横向布局左右两侧对齐(十九)

横向布局HBox在子节点A、B中添加<HBox HBox.hgrow="ALWAYS"></HBox> 即可做到A靠左侧、B靠右侧:

<HBox fx:id="hBox" alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="600.0">
    <children>
         <Label prefWidth="350.0"
                text="IDEA将JavaFx打包为exe Win+Mac+Linux多平台分发等等.exe">
             <font>
                 <Font size="14.0"/>
             </font>
         </Label>
         <!-- 关键 -->
         <HBox HBox.hgrow="ALWAYS">
         </HBox>
         <Label>
             <tooltip>
                 <Tooltip text="查看下载源" font="16"/>
             </tooltip>
             <graphic>
                 <FontIcon iconLiteral="fa-eye" iconSize="20"/>
             </graphic>
         </Label>
     </children>
 </HBox>

效果
在这里插入图片描述

posted @ 2022-09-16 00:08  凌康  阅读(305)  评论(0编辑  收藏  举报