我将 JavaFx
与 Scene Builder
一起使用,我是新手,我想更改 accordion
的图标及其位置,就像那样图像;
我找到了这个 CSS
,但我做不到;
.titled-pane .title{
-fx-background-radius: 30;
-fx-background-image:url('ac.jpg');
}
最佳答案
这很简单,只需将 Hbox 添加到标题并在添加您想要的内容(Button、ImageView)之后立即设置对齐
<TitledPane animated="false" collapsible="false" contentDisplay="RIGHT" layoutX="900.0" layoutY="500.0" prefHeight="206.0" prefWidth="431.0" stylesheets="@menu.css" text="Message" textFill="WHITE">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
</content>
<font>
<Font name="Arial Bold" size="12.0" />
</font>
<graphic>
<HBox alignment="TOP_RIGHT" prefHeight="24.0" prefWidth="352.0">
<children>
<ImageView fitHeight="21.0" fitWidth="18.0" pickOnBounds="true" preserveRatio="true" />
</children>
</HBox>
</graphic>
</TitledPane>
关于java - 更改 Accordion 图标和位置 JavaFX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15024178/