2013-02-22 94 views
0

我使用JavaFxScene Builder,我是新手,我想更改accordion的图标及其位置,如图像; 我觉得这个CSS,但我不能那样做;更改手风琴图标和位置JavaFX

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

enter image description here

+1

看到此相关的Q&A [如何改变标题组件在JavaFX中的TitledPane中](http://stackoverflow.com/q/11765436)。手风琴组件与标题栏有相同的css选择器,请参阅caspian.css。 – 2013-02-22 13:57:32

+0

[如何更改JavaFX TitledPane中的标题组件]可能的重复(http://stackoverflow.com/questions/11765436/how-to-change-header-component-in-titledpane-in-javafx) – jewelsea 2013-02-22 19:31:34

回答

0

很容易,只需添加HBOX以头和后置alignement正确添加你想要的东西(按钮,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>