如何设置JTabbedPane选项卡的高度,宽度,背景前景色(选中和未选中的选项卡) [英] How to set JTabbedPane Tab height width background foreground color (Both selected and Unselected Tab)
本文介绍了如何设置JTabbedPane选项卡的高度,宽度,背景前景色(选中和未选中的选项卡)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何设置 JTabbedPane
选项卡背景和前景,高度和宽度(选中和未选中的选项卡)
How to set the JTabbedPane
Tab background and Foreground, Height and Width (Both selected and Unselected Tab)
推荐答案
您可以将新值设置为UIDefaults:
You can set new values to the UIDefaults:
UIDefaults def = UIManager.getLookAndFeelDefaults();
def.put( "TabbedPane.foreground", Color.RED );
def.put( "TabbedPane.textIconGap", new Integer(16) );
def.put( "TabbedPane.background", Color.BLUE );
def.put( "TabbedPane.tabInsets", new Insets(10,10,10,10) );
def.put( "TabbedPane.selectedTabPadInsets", new Insets(10,20,10,20) );
这是按键列表
TabbedPane.textIconGap
TabbedPane.contentOpaque
TabbedPane.focus
TabbedPane.foreground
TabbedPane.tabRunOverlay
TabbedPane.shadow
TabbedPane.darkShadow
TabbedPane.background
TabbedPane.ancestorInputMap
TabbedPane.focusInputMap
TabbedPane.tabInsets
TabbedPane.light
TabbedPane.contentBorderInsets
TabbedPane.tabsOverlapBorder
TabbedPane.tabsOpaque
TabbedPane.tabAreaInsets
TabbedPane.highlight
TabbedPane.font
TabbedPane.selectedTabPadInsets
对于Nimbus LookAndFeel,还有其他一些 Nimbus默认值,例如:
For Nimbus LookAndFeel there are some other Nimbus Defaults like:
TabbedPane:TabbedPaneTabArea.contentMargins
TabbedPane:TabbedPaneTabArea[Enabled].backgroundPainter
TabbedPane:TabbedPaneTab[Selected].backgroundPainter
TabbedPane:TabbedPaneTabArea[Enabled].backgroundPainter
TabbedPane:TabbedPaneTab.contentMargins
TabbedPane.tabOverlap
这篇关于如何设置JTabbedPane选项卡的高度,宽度,背景前景色(选中和未选中的选项卡)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文