TITLE:JTabbedPaneのタブエリア背景色などをテスト
#navi(../)
#tags()
RIGHT:Posted by &author(aterai); at 2011-01-03
*JTabbedPaneのタブエリア背景色などをテスト [#g60a9b96]
Metal LnF のJTabbedPaneで、タブエリアの背景色などを変更するテストをしています。

-&jnlp;
-&jar;
-&zip;

//#screenshot
#ref(http://lh4.ggpht.com/_9Z4BYR88imo/TSFbcaeJLEI/AAAAAAAAAw0/zQFscoerEGk/s800/TabAreaBackground.png)

**サンプルコード [#ec1711da]
#code(link){{
UIManager.put("TabbedPane.shadow",                Color.GRAY);
UIManager.put("TabbedPane.darkShadow",            Color.GRAY);
UIManager.put("TabbedPane.light",                 Color.GRAY);
UIManager.put("TabbedPane.highlight",             Color.GRAY);
UIManager.put("TabbedPane.tabAreaBackground",     Color.GRAY);
UIManager.put("TabbedPane.unselectedBackground",  Color.GRAY);
UIManager.put("TabbedPane.background",            Color.GRAY);
UIManager.put("TabbedPane.foreground",            Color.WHITE);
UIManager.put("TabbedPane.focus",                 Color.WHITE);
UIManager.put("TabbedPane.contentAreaColor",      Color.WHITE);
UIManager.put("TabbedPane.selected",              Color.WHITE);
UIManager.put("TabbedPane.selectHighlight",       Color.WHITE);
UIManager.put("TabbedPane.borderHightlightColor", Color.WHITE);
}}

**解説 [#x4421498]
上記のサンプルでは、JPanelタブのJCheckBoxでJTabbedPaneを不透明にしたり、JComboBoxでキーを指定し、 UIManager.put("TabbedPane.unselectedBackground",  Color.GREEN); などとして色を変更することができます。

----
タブ文字色は、JTabbedPane#setForegroundAt(...)メソッドを使用して切り替えています。

- [[JTabbedPaneの選択文字色を変更>Swing/ColorTab]]
- [[JTabbedPaneのタブ文字列をハイライト>Swing/TabTitleHighlight]]

//**参考リンク
**コメント [#f0162397]
#comment