简体   繁体   English

在JTabbedPane的左侧添加图标

[英]Adding icon on the left side of the JTabbedPane

How to add an icon on the left side of JTabbedPane while using JPanel as the component of JTabbedPane ? 使用JPanel作为JTabbedPane的组件时,如何在JTabbedPane的左侧添加图标?

As I know how to add icon on the left side of the JTabbedPane while using JLabel but don't know what to do in case of JPanel 我知道如何在使用JLabel时在JTabbedPane的左侧添加图标,但是不知道在使用JPanel该怎么做

I assume you mean the JTabbedPane 's tab component. 我假设您的意思是JTabbedPane的tab组件。 If you are using a JPanel , you will need to add a JLabel to the panel and apply an appropriate layout manager to position the elements the way you want them 如果使用的是JPanel ,则需要向面板中添加JLabel并应用适当的布局管理器以所需的方式JLabel元素

There is an example in the How to Use Tabbed Panes under the section Tabs With Custom Components , it does add a JButton to the right hand side, but I'm sure you can figure out how to switch to a JLabel on the left side... 在“ 使用 自定义组件的标签 ”部分的“ 如何使用选项卡式窗格”中有一个示例,它确实在右侧添加了JButton ,但是我敢肯定,您可以在左侧找出如何切换到JLabel的方法。 ..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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