0

我用JavaFxwith Scene Builder,我是新手,我想改变图标accordion及其位置,就像那个图像;我找到了这个CSS,但我做不到;

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

在此处输入图像描述

4

1 回答 1

0

这很容易,只需将 Hbox 添加到标题并在添加您想要的内容之后立即设置对齐(按钮,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>
于 2017-08-10T16:22:49.480 回答