如何在JTabbedPane中更改选项卡位置? [英] How to change tabs location in JTabbedPane?
问题描述
我想将标签位置从左到中更改。我怎样才能做到这一点?我想我必须改变Look& Feel,但我不知道如何。
I want to change tabs location from left to center. How can I do this? I think I must change Look&Feel, but I don't know how.
从这个:
对此:
推荐答案
正如您已经指出的那样,您必须使用支持此设计的LookAndFeel(居中的Tab键)。
当您的选择的LaF不支持这个,你必须编写自己的 TabbedPaneUI。
(但这可能不是很容易。)
As you already pointed out, you have to use an LookAndFeel which supports this design (centered Tab-Button).
When your selected LaF does not support this, you have to write your own TabbedPaneUI.
(But this may not be very easy.)
如果您不想创建自己的TabbedPaneUI,则必须查找支持这种布局的现有自定义TabbedPaneUI或TabbedPane-Component。
If you do not want to create your own TabbedPaneUI, you have to look for an existing custom TabbedPaneUI or TabbedPane-Component, which support this kind of layout.
You can take a look at this article, to get started:
http://www.javaworld.com/article/2072927/swing-gui-programmingloseandmaxtabbedpane--an-enha/swing-gui-programming/closeandmaxtabbedpane--an-enhanced-jtabbedpane.html
这篇关于如何在JTabbedPane中更改选项卡位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!