更改Accordion图标并定位JavaFX

时间:2013-02-22 12:23:39

标签: java css javafx

我将JavaFxScene Builder一起使用,我是新手,我想更改accordion的图标及其位置,就像那个图像一样; 我发现 CSS ,但我不能这样做;

.titled-pane .title{
-fx-background-radius: 30;
-fx-background-image:url('ac.jpg');
}

enter image description here

1 个答案:

答案 0 :(得分:0)

这很容易,只需将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>