JavaTM Platform
Standard Ed. 6

java.awt
类 SystemColor

java.lang.Object
  继承者 java.awt.Color
      继承者 java.awt.SystemColor
所有已实现的接口:
Paint, Transparency, Serializable

public final class SystemColor
     
extends Color
implements Serializable

封装表示系统中本机 GUI 对象颜色的象征性颜色的类。对于支持系统颜色动态更新的系统而言(当用户更改颜色时),这些象征性颜色的实际 RGB 值也将发生动态更改。要比较 SystemColor 对象的“当前”RGB 值与非象征性 Color 对象,应该使用 getRGB,而不是 equals

注意,因为 GUI 对象在每个平台上的呈现可能各不相同,所以从一个平台到另一个平台,这些系统颜色应用于 GUI 对象的方式可能也会稍有不同。

通过 java.awt.Toolkit 上的 getDesktopProperty 方法也可以使用系统颜色值。

另请参见:
Toolkit.getDesktopProperty(java.lang.String), 序列化表格

字段摘要
static int ACTIVE_CAPTION
          activeCaption 系统颜色的数组索引。
static int ACTIVE_CAPTION_BORDER
          activeCaptionBorder 系统颜色的数组索引。
static int ACTIVE_CAPTION_TEXT
          activeCaptionText 系统颜色的数组索引。
static SystemColor activeCaption
          为当前活动窗口的窗口标题提供的背景色。
static SystemColor activeCaptionBorder
          为当前活动窗口的边框提供的颜色。
static SystemColor activeCaptionText
          为当前活动窗口的窗口标题文本提供的颜色。
static SystemColor control
          为控制面板和控制对象(比如按钮)提供的颜色。
static int CONTROL
          control 系统颜色的数组索引。
static int CONTROL_DK_SHADOW
          controlDkShadow 系统颜色的数组索引。
static int CONTROL_HIGHLIGHT
          controlHighlight 系统颜色的数组索引。
static int CONTROL_LT_HIGHLIGHT
          controlLtHighlight 系统颜色的数组索引。
static int CONTROL_SHADOW
          controlShadow 系统颜色的数组索引。
static int CONTROL_TEXT
          controlText 系统颜色的数组索引。
static SystemColor controlDkShadow
          为 3D 控制对象(比如按钮)的加黑阴影区域提供的颜色。
static SystemColor controlHighlight
          为 3D 控制对象(比如按钮)的亮区提供的颜色。
static SystemColor controlLtHighlight
          为 3D 控制对象(比如按钮)的高亮区域提供的颜色。
static SystemColor controlShadow
          为 3D 控制对象(比如按钮)的阴影区域提供的颜色。
static SystemColor controlText
          为控制面板和控制对象(比如按钮)的文本提供的颜色。
static SystemColor desktop
          为桌面背景提供的颜色。
static int DESKTOP
          desktop 系统颜色的数组索引。
static int INACTIVE_CAPTION
          inactiveCaption 系统颜色的数组索引。
static int INACTIVE_CAPTION_BORDER
          inactiveCaptionBorder 系统颜色的数组索引。
static int INACTIVE_CAPTION_TEXT
          inactiveCaptionText 系统颜色的数组索引。
static SystemColor inactiveCaption
          为非活动窗口的窗口标题提供的背景色。
static SystemColor inactiveCaptionBorder
          为非活动窗口的边框提供的颜色。
static SystemColor inactiveCaptionText
          为非活动窗口的窗口标题文本提供的颜色。
static SystemColor info
          为工具栏提示或定点帮助提供的背景色。
static int INFO
          info 系统颜色的数组索引。
static int INFO_TEXT
          infoText 系统颜色的数组索引。
static SystemColor infoText
          为工具栏提示或定点帮助的文本提供的颜色。
static SystemColor menu
          为菜单提供的背景色。
static int MENU
          menu 系统颜色的数组索引。
static int MENU_TEXT
          menuText 系统颜色的数组索引。
static SystemColor menuText
          为菜单文本提供的颜色。
static int NUM_COLORS
          数组中系统颜色的数量。
static SystemColor scrollbar
          为滚动条提供的背景色。
static int SCROLLBAR
          scrollbar 系统颜色的数组索引。
static SystemColor text
          为文本控制对象(比如文本字段和组合框)提供的背景色。
static int TEXT
          text 系统颜色的数组索引。
static int TEXT_HIGHLIGHT
          textHighlight 系统颜色的数组索引。
static int TEXT_HIGHLIGHT_TEXT
          textHighlightText 系统颜色的数组索引。
static int TEXT_INACTIVE_TEXT
          textInactiveText 系统颜色的数组索引。
static int TEXT_TEXT
          textText 系统颜色的数组索引。
static SystemColor textHighlight
          为选则项(比如菜单、组合框和文本)提供的背景色。
static SystemColor textHighlightText
          为选则项(比如菜单、组合框和文本)的文本提供的颜色。
static SystemColor textInactiveText
          为非活动项(比如菜单中的项)的文本提供的颜色。
static SystemColor textText
          为文本控制对象(比如文本字段和组合框)的文本提供的颜色。
static SystemColor window
          为窗口的内部区域提供的背景色。
static int WINDOW
          window 系统颜色的数组索引。
static int WINDOW_BORDER
          windowBorder 系统颜色的数组索引。
static int WINDOW_TEXT
          windowText 系统颜色的数组索引。
static SystemColor windowBorder
          为窗口内部区域的边框提供的颜色。
static SystemColor windowText
          为窗口内部区域的文本提供的颜色。
 
从类 java.awt.Color 继承的字段
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW
 
从接口 java.awt.Transparency 继承的字段
BITMASK, OPAQUE, TRANSLUCENT
 
方法摘要
 PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, RenderingHints hints)
          创建并返回用来生成纯色模式的 PaintContext
 int getRGB()
          获取表示象征性颜色的“当前”RGB 值。
 String toString()
          返回此 Color 值的字符串表示形式。
 
从类 java.awt.Color 继承的方法
brighter, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, HSBtoRGB, RGBtoHSB
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

字段详细信息

DESKTOP

public static final int DESKTOP
desktop 系统颜色的数组索引。

另请参见:
desktop, 常量字段值

ACTIVE_CAPTION

public static final int ACTIVE_CAPTION
activeCaption 系统颜色的数组索引。

另请参见:
activeCaption, 常量字段值

ACTIVE_CAPTION_TEXT

public static final int ACTIVE_CAPTION_TEXT
activeCaptionText 系统颜色的数组索引。

另请参见:
activeCaptionText, 常量字段值

ACTIVE_CAPTION_BORDER

public static final int ACTIVE_CAPTION_BORDER
activeCaptionBorder 系统颜色的数组索引。

另请参见:
activeCaptionBorder, 常量字段值

INACTIVE_CAPTION

public static final int INACTIVE_CAPTION
inactiveCaption 系统颜色的数组索引。

另请参见:
inactiveCaption, 常量字段值

INACTIVE_CAPTION_TEXT

public static final int INACTIVE_CAPTION_TEXT
inactiveCaptionText 系统颜色的数组索引。

另请参见:
inactiveCaptionText, 常量字段值

INACTIVE_CAPTION_BORDER

public static final int INACTIVE_CAPTION_BORDER
inactiveCaptionBorder 系统颜色的数组索引。

另请参见:
inactiveCaptionBorder, 常量字段值

WINDOW

public static final int WINDOW
window 系统颜色的数组索引。

另请参见:
window, 常量字段值

WINDOW_BORDER

public static final int WINDOW_BORDER
windowBorder 系统颜色的数组索引。

另请参见:
windowBorder, 常量字段值

WINDOW_TEXT

public static final int WINDOW_TEXT
windowText 系统颜色的数组索引。

另请参见:
windowText, 常量字段值

MENU

public static final int MENU
menu 系统颜色的数组索引。

另请参见:
menu, 常量字段值

MENU_TEXT

public static final int MENU_TEXT
menuText 系统颜色的数组索引。

另请参见:
menuText, 常量字段值

TEXT

public static final int TEXT
text 系统颜色的数组索引。

另请参见:
text, 常量字段值

TEXT_TEXT

public static final int TEXT_TEXT
textText 系统颜色的数组索引。

另请参见:
textText, 常量字段值

TEXT_HIGHLIGHT

public static final int TEXT_HIGHLIGHT
textHighlight 系统颜色的数组索引。

另请参见:
textHighlight, 常量字段值

TEXT_HIGHLIGHT_TEXT

public static final int TEXT_HIGHLIGHT_TEXT
textHighlightText 系统颜色的数组索引。

另请参见:
textHighlightText, 常量字段值

TEXT_INACTIVE_TEXT

public static final int TEXT_INACTIVE_TEXT
textInactiveText 系统颜色的数组索引。

另请参见:
textInactiveText, 常量字段值

CONTROL

public static final int CONTROL
control 系统颜色的数组索引。

另请参见:
control, 常量字段值

CONTROL_TEXT

public static final int CONTROL_TEXT
controlText 系统颜色的数组索引。

另请参见:
controlText, 常量字段值

CONTROL_HIGHLIGHT

public static final int CONTROL_HIGHLIGHT
controlHighlight 系统颜色的数组索引。

另请参见:
controlHighlight, 常量字段值

CONTROL_LT_HIGHLIGHT

public static final int CONTROL_LT_HIGHLIGHT
controlLtHighlight 系统颜色的数组索引。

另请参见:
controlLtHighlight, 常量字段值

CONTROL_SHADOW

public static final int CONTROL_SHADOW
controlShadow 系统颜色的数组索引。

另请参见:
controlShadow, 常量字段值

CONTROL_DK_SHADOW

public static final int CONTROL_DK_SHADOW
controlDkShadow 系统颜色的数组索引。

另请参见:
controlDkShadow, 常量字段值

SCROLLBAR

public static final int SCROLLBAR
scrollbar 系统颜色的数组索引。

另请参见:
scrollbar, 常量字段值

INFO

public static final int INFO
info 系统颜色的数组索引。

另请参见:
info, 常量字段值

INFO_TEXT

public static final int INFO_TEXT
infoText 系统颜色的数组索引。

另请参见:
infoText, 常量字段值

NUM_COLORS

public static final int NUM_COLORS
数组中系统颜色的数量。

另请参见:
常量字段值

desktop

public static final SystemColor desktop
为桌面背景提供的颜色。


activeCaption

public static final SystemColor activeCaption
为当前活动窗口的窗口标题提供的背景色。


activeCaptionText

public static final SystemColor activeCaptionText
为当前活动窗口的窗口标题文本提供的颜色。


activeCaptionBorder

public static final SystemColor activeCaptionBorder
为当前活动窗口的边框提供的颜色。


inactiveCaption

public static final SystemColor inactiveCaption
为非活动窗口的窗口标题提供的背景色。


inactiveCaptionText

public static final SystemColor inactiveCaptionText
为非活动窗口的窗口标题文本提供的颜色。


inactiveCaptionBorder

public static final SystemColor inactiveCaptionBorder
为非活动窗口的边框提供的颜色。


window

public static final SystemColor window
为窗口的内部区域提供的背景色。


windowBorder

public static final SystemColor windowBorder
为窗口内部区域的边框提供的颜色。


windowText

public static final SystemColor windowText
为窗口内部区域的文本提供的颜色。


menu

public static final SystemColor menu
为菜单提供的背景色。


menuText

public static final SystemColor menuText
为菜单文本提供的颜色。


text

public static final SystemColor text
为文本控制对象(比如文本字段和组合框)提供的背景色。


textText

public static final SystemColor textText
为文本控制对象(比如文本字段和组合框)的文本提供的颜色。


textHighlight

public static final SystemColor textHighlight
为选则项(比如菜单、组合框和文本)提供的背景色。


textHighlightText

public static final SystemColor textHighlightText
为选则项(比如菜单、组合框和文本)的文本提供的颜色。


textInactiveText

public static final SystemColor textInactiveText
为非活动项(比如菜单中的项)的文本提供的颜色。


control

public static final SystemColor control
为控制面板和控制对象(比如按钮)提供的颜色。


controlText

public static final SystemColor controlText
为控制面板和控制对象(比如按钮)的文本提供的颜色。


controlHighlight

public static final SystemColor controlHighlight
为 3D 控制对象(比如按钮)的亮区提供的颜色。此颜色通常是从提供 3D 效果的 control 背景色中得来的。


controlLtHighlight

public static final SystemColor controlLtHighlight
为 3D 控制对象(比如按钮)的高亮区域提供的颜色。此颜色通常是从提供 3D 效果的 control 背景色中得来的。


controlShadow

public static final SystemColor controlShadow
为 3D 控制对象(比如按钮)的阴影区域提供的颜色。此颜色通常是从提供 3D 效果的 control 背景色中得来的。


controlDkShadow

public static final SystemColor controlDkShadow
为 3D 控制对象(比如按钮)的加黑阴影区域提供的颜色。此颜色通常是从提供 3D 效果的 control 背景色中得来的。


scrollbar

public static final SystemColor scrollbar
为滚动条提供的背景色。


info

public static final SystemColor info
为工具栏提示或定点帮助提供的背景色。


infoText

public static final SystemColor infoText
为工具栏提示或定点帮助的文本提供的颜色。

方法详细信息

getRGB

public int getRGB()
获取表示象征性颜色的“当前”RGB 值。(24-31 位表示 0xff,16-23 位表示红色,8-15 位表示绿色,0-7 位表示蓝色)。

覆盖:
Color 中的 getRGB
返回:
默认 sRGB ColorModel 中表示颜色的 RGB 值。
另请参见:
ColorModel.getRGBdefault(), Color.getBlue(), Color.getGreen(), Color.getRed()

createContext

public PaintContext createContext(ColorModel cm,
                                  Rectangle r,
                                  Rectangle2D r2d,
                                  AffineTransform xform,
                                  RenderingHints hints)
创建并返回用来生成纯色模式的 PaintContext。这允许将 Color 对象用作需要一个对象来实现 Paint 接口的任何方法的参数。

指定者:
接口 Paint 中的 createContext
覆盖:
Color 中的 createContext
参数:
cm - 指定的 ColorModel
r - 指定的 Rectangle
r2d - 指定的 Rectangle2D
xform - 指定的 AffineTransform
hints - 指定的 RenderingHints
返回:
一个用来生成固定颜色模式的 PaintContext
另请参见:
Paint, PaintContext, Graphics2D.setPaint(java.awt.Paint)

toString

public String toString()
返回此 Color 值的字符串表示形式。此方法仅用于调试目的,对于各个实现,所返回字符串的内容和格式可能有所不同。返回的字符串可以为空,但不可以为 null

覆盖:
Color 中的 toString
返回:
Color 的字符串表示形式

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策