简体   繁体   中英

How to add an icon to the Tab control in FXML?

I'm using javafx 2.0. I want to add an icon to the Tab in fxml:

example:

     <TabPane>
         <tabs>
            <Tab text="abc" >
            </Tab> 
         </tabs>
     </TabPane>

I found a solution:

<Tab> 
    <graphic>
        <ImageView>
            <image>
                    <Image url="@image.png"/>
            </image>
        </ImageView>
    </graphic>
    <content>
        ...
    </content>
</Tab> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM