TITLE:SystemColorの使用

SystemColorの使用

Posted by terai at 2003-09-25
  • category: swing folder: SystemColor title: SystemColorの使用 tags: [SystemColor] author: aterai pubdate: 2003-10-20 description: Swingコンポーネントの色をSystemColorクラスから取得します。 image: https://lh4.googleusercontent.com/_9Z4BYR88imo/TQTUESCOFBI/AAAAAAAAAlc/eXW_0wilSew/s800/SystemColor.png

概要

Swingコンポーネントの色をSystemColorクラスから取得します。

概要

Swingコンポーネントの色をSystemColorクラスから取得します。

#screenshot

&jnlp;
&jar;
&zip;

サンプルコード

#spanend
#spandel
Color color = SystemColor.textHighlightText;
#spanend
#spanadd
* サンプルコード [#sourcecode]
#spanend
#spanadd
#code(link){{
#spanend
#spanadd
Box box = Box.createVerticalBox();
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.desktop, "desktop"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.activeCaption, "activeCaption"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.inactiveCaption, "inactiveCaption"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.activeCaptionText, "activeCaptionText"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.inactiveCaptionText, "inactiveCaptionText"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.activeCaptionBorder, "activeCaptionBorder"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.inactiveCaptionBorder, "inactiveCaptionBorder"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.window, "window"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.windowText, "windowText"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.menu, "menu"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.menuText, "menuText"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.text, "text"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.textHighlight, "textHighlight"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.textText, "textText"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.textHighlightText, "textHighlightText"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.control, "control"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.controlLtHighlight, "controlLtHighlight"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.controlHighlight, "controlHighlight"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.controlShadow, "controlShadow"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.controlDkShadow, "controlDkShadow"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.controlText, "controlText"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.control, "control"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.scrollbar, "scrollbar"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.info, "info"));
#spanend
#spanadd
box.add(makeSystemColorPanel(SystemColor.infoText, "infoText"));
#spanend

解説

各プラットフォームのディスクトップデザインに対応したシステムカラーは、SystemColorクラスのstaticフィールドにまとめて定義されています。

解説

各プラットフォームのデスクトップデザインに対応したシステムカラーは、SystemColorクラスのstaticフィールドにまとめて定義されています。例えばWindowsプラットフォームでデスクトップのカスタマイズでテーマなどを変更すると、このSystemColorも動的にその変更に追従します。

参考リンク

  • システムカラー
  • LookAndFeelを変更してもSystemColorは変化しない
  • GTKLookAndFeelがシステムデフォルトになる環境ではSystemColorを取得不可

コメント

  • Ubuntu などでは、SystemColorはあまりうまくいかないようです。UIManagerを使った方がいいかも。 -- terai

参考リンク

コメント