如何隐藏 JTabbed 窗格中的选项卡位置?

问题描述 投票:0回答:1

我在我的项目中使用 JTabbedPane。在此我可以将选项卡位置更改为顶部、底部、左侧、右侧。喜欢,

 tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);
 tabbedPane.setTabPlacement(JTabbedPane.TOP);

但我想隐藏所有选项卡,并像普通面板一样使用选项卡式索引 id,而不是在我的设计中显示该选项卡。有没有办法隐藏java swing中的选项卡位置,例如,

 tabbedPane.setTabPlacement(null);
java swing tabs jtabbedpane
1个回答
0
投票

使用这个来隐藏选项卡位置

    for (int i = 0; i < tabbedPane.getTabCount(); i++) {
    tabbedPane.setTabComponentAt(i, new JLabel());
    }
© www.soinside.com 2019 - 2024. All rights reserved.