Swing/TabAreaBackground のバックアップ差分(No.10)
- バックアップ一覧
- 現在との差分 を表示
- 現在との差分 - Visual を表示
- ソース を表示
- バックアップ を表示
- Swing/TabAreaBackground へ行く。
- 1 (2011-01-03 (月) 14:25:13)
- 2 (2012-12-23 (日) 05:26:25)
- 3 (2013-10-08 (火) 15:02:55)
- 4 (2015-10-30 (金) 18:48:55)
- 5 (2016-06-01 (水) 19:01:26)
- 6 (2016-07-14 (木) 14:15:18)
- 7 (2017-03-28 (火) 15:39:15)
- 8 (2018-02-06 (火) 15:28:46)
- 9 (2018-02-16 (金) 19:47:21)
- 10 (2018-10-12 (金) 17:40:59)
- 11 (2019-09-25 (水) 20:32:45)
- 12 (2021-05-09 (日) 03:10:01)
- 13 (2022-08-20 (土) 22:15:25)
- 追加された行はこの色です。
- 削除された行はこの色です。
---
category: swing
folder: TabAreaBackground
title: JTabbedPaneのタブエリア背景色などをテスト
tags: [JTabbedPane, UIManager, MetalLookAndFeel]
author: aterai
pubdate: 2011-01-03T14:25:13+09:00
description: MetalLookAndFeelのJTabbedPaneで、タブエリアの背景色などを変更するテストをしています。
image: https://lh4.googleusercontent.com/_9Z4BYR88imo/TSFbcaeJLEI/AAAAAAAAAw0/zQFscoerEGk/s800/TabAreaBackground.png
---
* 概要 [#summary]
`MetalLookAndFeel`の`JTabbedPane`で、タブエリアの背景色などを変更するテストをしています。
#download(https://lh4.googleusercontent.com/_9Z4BYR88imo/TSFbcaeJLEI/AAAAAAAAAw0/zQFscoerEGk/s800/TabAreaBackground.png)
* サンプルコード [#sourcecode]
#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);
}}
* 解説 [#explanation]
上記のサンプルでは、`UIManager.put("TabbedPane.unselectedBackground", Color.GREEN);`などを利用して、`MetalLookAndFeel`でのタブエリアの背景色などを変更することができます。
- `BasicLookAndFeel`、`MetalLookAndFeel`でのみ有効
- `JPanel`タブ内に配置されている`JCheckBox`で、`JTabbedPane`を不透明に設定可能
- `JPanel`タブ内に配置されている`JComboBox`で、`TabbedPane.tabAreaBackground`などのキーを指定し、その色の変更が可能
- タブ文字色は、`JTabbedPane#setForegroundAt(...)`メソッドを使用して切り替え可能
* 参考リンク [#reference]
- [[JTabbedPaneの選択文字色を変更>Swing/ColorTab]]
- [[JTabbedPaneのタブ文字列をハイライト>Swing/TabTitleHighlight]]
- [https://bugs.openjdk.java.net/browse/JDK-8078269 JDK-8078269 JTabbedPane UI Property TabbedPane.tabAreaBackground no longer works - Java Bug System]
* コメント [#comment]
#comment
#comment