How to set JTabbedPane Tab height width background foreground color (Both selected and Unselected Tab)

后端 未结 3 1037
一生所求
一生所求 2021-01-20 17:01

How to set the JTabbedPane Tab background and Foreground, Height and Width (Both selected and Unselected Tab)

3条回答
  •  忘掉有多难
    2021-01-20 17:07

    You can control the height as follows:

    JTabbedPane tabs = new JTabbedPane();
    tabs.setUI(new BasicTabbedPaneUI() {
        @Override
        protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) {
            return 45; // manipulate this number however you please.
        }
    });
    

    If each tab needs to be a different height, this answer might also be useful: How to handle the height of the tab title in JTabbedPane

提交回复
热议问题