public class ColorType extends Object
各SynthStyle
には、SynthStyle.getColor(SynthContext, ColorType)
メソッドを介してアクセスされるColorType
のセットがあります。SynthStyle
のinstallDefaults
は、FOREGROUND
カラーをコンポーネントのフォアグラウンドとしてインストールし、BACKGROUND
カラーをコンポーネントのバックグラウンドとしてインストールします(フォアグラウンド・カラーやバックグラウンド・カラーを明示的に指定しない場合)。コンポーネントの中には、さらにいくつかの色に基づくプロパティをサポートしているものもあります。たとえば、JList
にはSynthConstants.SELECTED
のコンポーネント状態に合わせてFOREGROUND
にマップされるselectionForeground
プロパティがあります。
次の例は、DISABLED
状態の場合は赤い色を返し、それ以外の場合は黒い色を返すカスタムのSynthStyle
を示しています。
class MyStyle extends SynthStyle { private Color disabledColor = new ColorUIResource(Color.RED); private Color color = new ColorUIResource(Color.BLACK); protected Color getColorForState(SynthContext context, ColorType type){ if (context.getComponentState() == SynthConstants.DISABLED) { return disabledColor; } return color; } }
修飾子と型 | フィールドと説明 |
---|---|
static ColorType |
BACKGROUND
領域のバックグラウンド用のColorTypeです。
|
static ColorType |
FOCUS
フォーカス用のColorTypeです。
|
static ColorType |
FOREGROUND
領域のフォアグラウンド用のColorTypeです。
|
static int |
MAX_COUNT
ColorType の最大数。 |
static ColorType |
TEXT_BACKGROUND
領域のバックグラウンド用のColorTypeです。
|
static ColorType |
TEXT_FOREGROUND
領域のフォアグラウンド用のColorTypeです。
|
public static final ColorType FOREGROUND
public static final ColorType BACKGROUND
public static final ColorType TEXT_FOREGROUND
public static final ColorType TEXT_BACKGROUND
public static final ColorType FOCUS
public static final int MAX_COUNT
ColorType
の最大数。protected ColorType(String description)
description
- ColorTypeの説明を表すString。 バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。