我有这个按钮栏,其中包含一些按钮和一个滑块(在SceneBuilder中:)>
左侧的所有按钮,具有均匀的宽度-小间距-滑块填充剩余的宽度
->滑块需要使用fxml选择退出ButtonUniformSize
,我只找到了编程方式setButtonUniformSize
我也发现了这个问题:JavaFX: Align Buttons inside ButtonBar (using SceneBuilder or fxml),但它是关于分别配置和对齐按钮的,我不需要。
在下面的屏幕快照中,您可以看到方向设置为LEFT_TO_RIGHT
,但我不明白为什么它从右向左对齐?
这是SceneBuilder生成的代码的相关部分:
<VBox prefHeight="600.0" prefWidth="640.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1">
<children>
<MenuBar VBox.vgrow="NEVER">
[...]
</MenuBar>
<ButtonBar buttonMinWidth="25.0" nodeOrientation="LEFT_TO_RIGHT" VBox.vgrow="NEVER">
<buttons>
<Button mnemonicParsing="false" styleClass="stop" />
<Button mnemonicParsing="false" styleClass="playPause" />
<Slider styleClass="volume" />
</buttons>
<padding>
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
</padding>
</ButtonBar>
<FolderView VBox.vgrow="ALWAYS" />
</children>
</VBox>
[我在这个Buttonbar中有一些按钮和一个滑块(在SceneBuilder中):将所有按钮定位在左侧,并以均匀的宽度-小间距-滑块填充剩余的宽度->滑块需要选择退出...