简体   繁体   中英

JTabbedPane tab height with nimbus

I would like the change the height tab's tabbedpane, and to do so I tried several method without any success. First I tried with a spacer icon, the height is good, but the text of the tab is not center anymore. Then I tried to change Nimbus L&F properties, TabbedPane.tabInsets, TabbedPane:TabbedPaneTab.contentMargins, and TabbedPane:TabbedPaneTabArea.contentMargins nothing change. Finally I tried to extend BasicTabbedPaneUI and overide calculateTabHeight, but the background of the tab is not painted anymore.

Just use setTabComponentAt to set a custom component on the tab. You can set any component you want. If you just want a label with a bigger height, give setComponentAt a JLabel with a border, or with its preferredSize set.

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