Set size of tab in JTabbedPane
Asked Answered
A

3

5

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.

Ameba answered 29/1, 2012 at 11:22 Comment(0)
F
5

You can either create your own TabbedPaneUI, but it might be simpler if you just use the JTabbedPane#setTabComponentAt and use a larger component for rendering the tab title

Formularize answered 29/1, 2012 at 11:30 Comment(0)
C
8

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));

Cleome answered 3/6, 2014 at 2:14 Comment(0)
F
5

You can either create your own TabbedPaneUI, but it might be simpler if you just use the JTabbedPane#setTabComponentAt and use a larger component for rendering the tab title

Formularize answered 29/1, 2012 at 11:30 Comment(0)
F
3

In order to create custom tabbedPane, I recommand to check the Oracle tutorial. You have to create your own panel, then you can modify the Component that render the title. Finally you usesetTabComponentAt to put your own panel in the pane.

Freer answered 29/1, 2012 at 11:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.