|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一個類別 下一個類別 | 框架 無框架 | |||||||||
摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 |
java.lang.Object javax.swing.plaf.synth.ColorType
public class ColorType
可從某種樣式中獲取的一些顏色的型別安全列舉。
每個 SynthStyle
都有一組 ColorType
,可以使用 SynthStyle.getColor(SynthContext, ColorType)
方法來存取它們。SynthStyle
的 installDefaults
將安裝 FOREGROUND
顏色作為 Component 的前景色,並安裝 BACKGROUND
顏色作為元件的背景色(假定您沒有顯式指定前景色和背景色)。一些元件支持更多基於顏色的屬性,例如,JList
擁有屬性 selectionForeground
,該屬性將在元件狀態為 SynthConstants.SELECTED
的情況下被映射到 FOREGROUND
。
以下範例顯示了一個自定義 SynthStyle
,對於 DISABLED
狀態,它返回紅色,其他情況返回黑色。
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
某一 region 背景的 ColorType。 |
static ColorType |
FOCUS
焦點的 ColorType。 |
static ColorType |
FOREGROUND
某一 region 前景的 ColorType。 |
static int |
MAX_COUNT
最大 ColorType 數。 |
static ColorType |
TEXT_BACKGROUND
某一 region 背景的 ColorType。 |
static ColorType |
TEXT_FOREGROUND
某一 region 前景的 ColorType。 |
建構子摘要 | |
---|---|
protected |
ColorType(String description)
創建一個具有指定描述的 ColorType。 |
方法摘要 | |
---|---|
int |
getID()
以整數形式返回此 ColorType 的唯一 id。 |
String |
toString()
返回此 ColorType 的文本描述。 |
從類別 java.lang.Object 繼承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
欄位詳細資訊 |
---|
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 的字元串描述。方法詳細資訊 |
---|
public final int getID()
public String toString()
ColorType
的文本描述。
返回值就是用來創建 ColorType
的那個值。
Object
中的 toString
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一個類別 下一個類別 | 框架 無框架 | |||||||||
摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 |
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。