How to add close button to a JTabbedPane Tab?
问题 I'm working in with a JTabbedPane, I need to add a close button in the tabs to close the current one. I have been searching and as I understand I must extend from JPanel and add the close button as they say here But, is there a way to add the close buttons extending JTabbedPane or is there a easier way to do it? Thanks in advance, I really appreciate your time and your help. 回答1: Essentially, you're going to need to supply a "renderer" for the tab. Take a look at JTabbedPane.setTabComponentAt