Swing/NimbusColorPalette のバックアップの現在との差分(No.4)
TITLE:NimbusLookAndFeelのカラーパレット
Posted by aterai at 2012-07-30
NimbusLookAndFeelのカラーパレット
NimbusLookAndFeelのカラーパレットを変更します。- category: swing folder: NimbusColorPalette title: NimbusLookAndFeelのカラーパレット tags: [NimbusLookAndFeel, UIDefaults, JProgressBar] author: aterai pubdate: 2012-07-30T13:49:19+09:00 description: NimbusLookAndFeelのカラーパレットを変更します。 image:
概要
NimbusLookAndFeel
のカラーパレットを変更します。
- &jnlp;
- &jar;
- &zip;
Screenshot
Advertisement
サンプルコード
サンプルコード
UIDefaults def = UIManager.getLookAndFeelDefaults();
#spandel
def.put("nimbusOrange", new Color(255,220,35,200));
#spanend
#spanadd
def.put("nimbusOrange", new Color(255, 220, 35, 200));
#spanend
View in GitHub: Java, Kotlin解説
- 上:
- Nimbus Look&Feel の Primary Colors の一つ(上記のサンプルではnimbusOrange)を変更して全体で色を変更
解説
- 上
JProgressBar
:-
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); で特定のコンポーネントの色を設定
- 下
JProgressBar
:- 指定した領域を塗りつぶす
Painter
を作成してJProgressBar#putClientProperty("Nimbus.Overrides", d)
で特定のコンポーネントの色を設定UIDefaults d = new UIDefaults(); #spandel d.put("ProgressBar[Enabled].foregroundPainter", new Painter() { #spanend @Override public void paint(Graphics2D g, Object o, 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); #spanadd d.put("ProgressBar[Enabled].foregroundPainter", new Painter<JProgressBar>() { #spanend @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
参考リンク
- 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の色相を変更する
- こちらは
JLayer
+RGBImageFilter
でJProgressBar
全体の色を変更するサンプル
- こちらは