Set size of tab in JTabbedPane

Bulit picture Bulit · Jan 29, 2012 · Viewed 19.7k times · Source

Is there any way to change size of tab in JTabbedPane? I mean not all panel but only the small tab that user has to click to see what is under it.

Answer

Harsha Sampath picture Harsha Sampath · Jun 3, 2014

this is worked for me.

 JLabel lab = new JLabel();
 lab.setPreferredSize(new Dimension(200, 30));
 jTabbedPane1.setTabComponentAt(0, lab);  // tab index, jLabel

or try this change to all tab component in same sizes (called in main method)

UIManager.getLookAndFeelDefaults().put("TabbedPane:TabbedPaneTab.contentMargins", new Insets(10, 100, 0, 0));