dajood
dajood

Reputation: 4050

How to set the position of an ImageView in a TitledPane title?

I've solved the problem to bring an icon image into the header of a TitledPane like this:

    <TitledPane fx:id="x2" text="Strukturen">
            <graphic>
                <ImageView >
                        <image>
                            <Image url="@/de/myres/icons/arrow-out.png" />
                        </image>
                </ImageView>
            </graphic>
            <content>
                    <AnchorPane id="Content" minHeight="0.0" minWidth="0.0"
                        prefHeight="180.0" prefWidth="200.0" />
            </content>
            </TitledPane>

This looks like the following:

TitledPane header with icon

As you can see, it looks not very nice when the arrow for collapsing and this icon are shown beside each other directly.

How can i achieve to get the icon to the right side of the title bar?

Upvotes: 1

Views: 1064

Answers (1)

Andy Till
Andy Till

Reputation: 3511

You could leave the TitledPane text blank and set the icon node to be an HBox containing a Label on the left and an ImageView on the right.

Upvotes: 2

Related Questions