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

心不动则不痛 提交于 2019-12-19 10:10:06

问题


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>

回答1:


I found a solution:

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


来源:https://stackoverflow.com/questions/9648485/how-to-add-an-icon-to-the-tab-control-in-fxml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!