Swing/NimbusColorPalette のバックアップ(No.9)
- バックアップ一覧
 - 差分 を表示
 - 現在との差分 を表示
 - 現在との差分 - Visual を表示
 - ソース を表示
 - Swing/NimbusColorPalette へ行く。
  
- 1 (2012-07-30 (月) 13:49:19)
 - 2 (2012-07-30 (月) 15:00:36)
 - 3 (2012-07-30 (月) 17:37:30)
 - 4 (2012-08-02 (木) 20:45:08)
 - 5 (2012-12-08 (土) 06:48:14)
 - 6 (2013-06-28 (金) 17:25:07)
 - 7 (2013-08-17 (土) 15:40:51)
 - 8 (2014-06-24 (火) 20:33:27)
 - 9 (2014-11-01 (土) 00:27:15)
 - 10 (2015-11-21 (土) 02:47:39)
 - 11 (2017-04-04 (火) 14:17:08)
 - 12 (2017-04-07 (金) 13:51:51)
 - 13 (2017-05-11 (木) 12:32:03)
 - 14 (2018-05-02 (水) 14:52:55)
 - 15 (2020-04-25 (土) 20:45:48)
 - 16 (2021-10-26 (火) 23:59:53)
 - 17 (2025-01-03 (金) 08:57:02)
 - 18 (2025-01-03 (金) 09:01:23)
 - 19 (2025-01-03 (金) 09:02:38)
 - 20 (2025-01-03 (金) 09:03:21)
 - 21 (2025-01-03 (金) 09:04:02)
 - 22 (2025-06-19 (木) 12:41:37)
 - 23 (2025-06-19 (木) 12:43:47)
 
 
- title: NimbusLookAndFeelのカラーパレット tags: [NimbusLookAndFeel, UIDefaults, JProgressBar] author: aterai pubdate: 2012-07-30T13:49:19+09:00 description: NimbusLookAndFeelのカラーパレットを変更します。
 
概要
NimbusLookAndFeelのカラーパレットを変更します。
Screenshot

Advertisement
サンプルコード
UIDefaults def = UIManager.getLookAndFeelDefaults();
def.put("nimbusOrange", new Color(255,220,35,200));
View in GitHub: Java, Kotlin解説
- 上:
NimbusLookAndFeelのPrimary Colorsの一つ(上記のサンプルではnimbusOrange)を変更して全体で色を変更
 
以下の一覧は、Nimbus Defaults (The Java™ Tutorials > Creating a GUI With JFC/Swing > Modifying the Look and Feel)より引用
| Key | Value | Preview | 
| control | #d6d9df (214,217,223) | |
| info | #f2f2bd (242,242,189) | |
| nimbusAlertYellow | #ffdc23 (255,220,35) | |
| nimbusBase | #33628c (51,98,140) | |
| nimbusDisabledText | #8e8f91 (142,143,145) | |
| nimbusFocus | #73a4d1 (115,164,209) | |
| nimbusGreen | #b0b332 (176,179,50) | |
| nimbusInfoBlue | #2f5cb4 (47,92,180) | |
| nimbusLightBackground | #ffffff (255,255,255) | |
| nimbusOrange | #bf6204 (191,98,4) | |
| nimbusRed | #a92e22 (169,46,34) | |
| nimbusSelectedText | #ffffff (255,255,255) | |
| nimbusSelectionBackground | #39698a (57,105,138) | |
| text | #000000 (0,0,0) | 
- 下:
- 指定した領域を塗りつぶす
Painterを作成して、JProgressBar#putClientProperty("Nimbus.Overrides", d);で特定のコンポーネントの色を設定 
 - 指定した領域を塗りつぶす
 
UIDefaults d = new UIDefaults();
d.put("ProgressBar[Enabled].foregroundPainter", new Painter<JProgressBar>() { //JDK 1.6.0 new com.sun.java.swing.Painter() {
  @Override public void paint(Graphics2D g, JProgressBar c, int w, int h) {
    g.setColor(new Color(100,250,120,50));
    g.fillRect(0,0,w-1,h-1);
    g.setColor(new Color(100,250,120,150));
    g.fillRect(3,h/2,w-5,h/2-2);
  }
});
progressbar.putClientProperty("Nimbus.Overrides", d);
参考リンク
- Nimbus Defaults (The Java™ Tutorials > Creating a GUI With JFC/Swing > Modifying the Look and Feel)
 - java - How to change the color of a single JProgressBar in Nimbus? - Stack Overflow
 - JLayerを使ってJProgressBarの色相を変更する
- 指定した
JProgressBarの色変更は、JLayer+RGBImageFilter+JProgressBar#setOpaque(true);で可能。 
 - 指定した