java.awt
Class SystemColor

java.lang.Object
  |
  +--java.awt.Color
        |
        +--java.awt.SystemColor
All Implemented Interfaces:
Paint, Serializable, Transparency

public final class SystemColor
extends Color
implements Serializable

Safe: A class to encapsulate symbolic colors representing the color of native GUI objects on a system. For systems which support the dynamic update of the system colors (when the user changes the colors) the actual RGB values of these symbolic colors will also change dynamically. In order to compare the "current" RGB value of a SystemColor object with a non-symbolic Color object, getRGB should be used rather than equals.

Note that the way in which these system colors are applied to GUI objects may vary slightly from platform to platform since GUI objects may be rendered differently on each platform.

System color values may also be available through the getDesktopProperty method on java.awt.Toolkit.

Version:
1.22, 12/03/01
Author:
Carl Quinn, Amy Fowler
See Also:
Toolkit.getDesktopProperty(java.lang.String), Serialized Form

Field Summary
static int ACTIVE_CAPTION
          Enabled: The array index for the activeCaption system color.
static int ACTIVE_CAPTION_BORDER
          Enabled: The array index for the activeCaptionBorder system color.
static int ACTIVE_CAPTION_TEXT
          Enabled: The array index for the activeCaptionText system color.
static SystemColor activeCaption
          Enabled: The color rendered for the window-title background of the currently active window.
static SystemColor activeCaptionBorder
          Enabled: The color rendered for the border around the currently active window.
static SystemColor activeCaptionText
          Enabled: The color rendered for the window-title text of the currently active window.
static SystemColor control
          Enabled: The color rendered for the background of control panels and control objects, such as pushbuttons.
static int CONTROL
          Enabled: The array index for the control system color.
static int CONTROL_DK_SHADOW
          Enabled: The array index for the controlDkShadow system color.
static int CONTROL_HIGHLIGHT
          Enabled: The array index for the controlHighlight system color.
static int CONTROL_LT_HIGHLIGHT
          Enabled: The array index for the controlLtHighlight system color.
static int CONTROL_SHADOW
          Enabled: The array index for the controlShadow system color.
static int CONTROL_TEXT
          Enabled: The array index for the controlText system color.
static SystemColor controlDkShadow
          Enabled: The color rendered for dark shadow areas on 3D control objects, such as pushbuttons.
static SystemColor controlHighlight
          Enabled: The color rendered for light areas of 3D control objects, such as pushbuttons.
static SystemColor controlLtHighlight
          Enabled: The color rendered for highlight areas of 3D control objects, such as pushbuttons.
static SystemColor controlShadow
          Enabled: The color rendered for shadow areas of 3D control objects, such as pushbuttons.
static SystemColor controlText
          Enabled: The color rendered for the text of control panels and control objects, such as pushbuttons.
static SystemColor desktop
          Enabled: The color rendered for the background of the desktop.
static int DESKTOP
          Enabled: The array index for the desktop system color.
static int INACTIVE_CAPTION
          Enabled: The array index for the inactiveCaption system color.
static int INACTIVE_CAPTION_BORDER
          Enabled: The array index for the inactiveCaptionBorder system color.
static int INACTIVE_CAPTION_TEXT
          Enabled: The array index for the inactiveCaptionText system color.
static SystemColor inactiveCaption
          Enabled: The color rendered for the window-title background of inactive windows.
static SystemColor inactiveCaptionBorder
          Enabled: The color rendered for the border around inactive windows.
static SystemColor inactiveCaptionText
          Enabled: The color rendered for the window-title text of inactive windows.
static SystemColor info
          Enabled: The color rendered for the background of tooltips or spot help.
static int INFO
          Enabled: The array index for the info system color.
static int INFO_TEXT
          Enabled: The array index for the infoText system color.
static SystemColor infoText
          Enabled: The color rendered for the text of tooltips or spot help.
static SystemColor menu
          Enabled: The color rendered for the background of menus.
static int MENU
          Enabled: The array index for the menu system color.
static int MENU_TEXT
          Enabled: The array index for the menuText system color.
static SystemColor menuText
          Enabled: The color rendered for the text of menus.
static int NUM_COLORS
          Enabled: The number of system colors in the array.
static SystemColor scrollbar
          Enabled: The color rendered for the background of scrollbars.
static int SCROLLBAR
          Enabled: The array index for the scrollbar system color.
private static long serialVersionUID
           
private static int[] systemColors
           
static SystemColor text
          Enabled: The color rendered for the background of text control objects, such as textfields and comboboxes.
static int TEXT
          Enabled: The array index for the text system color.
static int TEXT_HIGHLIGHT
          Enabled: The array index for the textHighlight system color.
static int TEXT_HIGHLIGHT_TEXT
          Enabled: The array index for the textHighlightText system color.
static int TEXT_INACTIVE_TEXT
          Enabled: The array index for the textInactiveText system color.
static int TEXT_TEXT
          Enabled: The array index for the textText system color.
static SystemColor textHighlight
          Enabled: The color rendered for the background of selected items, such as in menus, comboboxes, and text.
static SystemColor textHighlightText
          Enabled: The color rendered for the text of selected items, such as in menus, comboboxes, and text.
static SystemColor textInactiveText
          Enabled: The color rendered for the text of inactive items, such as in menus.
static SystemColor textText
          Enabled: The color rendered for the text of text control objects, such as textfields and comboboxes.
static SystemColor window
          Enabled: The color rendered for the background of interior regions inside windows.
static int WINDOW
          Enabled: The array index for the window system color.
static int WINDOW_BORDER
          Enabled: The array index for the windowBorder system color.
static int WINDOW_TEXT
          Enabled: The array index for the windowText system color.
static SystemColor windowBorder
          Enabled: The color rendered for the border around interior regions inside windows.
static SystemColor windowText
          Enabled: The color rendered for text of interior regions inside windows.
 
Fields inherited from class 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, value, white, WHITE, yellow, YELLOW
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
private SystemColor(byte index)
          Creates a symbolic color that represents an indexed entry into system color cache.
 
Method Summary
 PaintContext createContext(java.awt.image.ColorModel cm, Rectangle r, java.awt.geom.Rectangle2D r2d, java.awt.geom.AffineTransform xform, RenderingHints hints)
          Enabled: Creates and returns a PaintContext used to generate a solid color pattern.
 int getRGB()
          Enabled: Gets the "current" RGB value representing the symbolic color.
 String toString()
          Suppressed: Returns a string representation of this Color's values.
private static void updateSystemColors()
          Called from & toolkit to update the above systemColors cache.
 
Methods inherited from class 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DESKTOP

public static final int DESKTOP
Enabled: The array index for the desktop system color.

See Also:
desktop

ACTIVE_CAPTION

public static final int ACTIVE_CAPTION
Enabled: The array index for the activeCaption system color.

See Also:
activeCaption

ACTIVE_CAPTION_TEXT

public static final int ACTIVE_CAPTION_TEXT
Enabled: The array index for the activeCaptionText system color.

See Also:
activeCaptionText

ACTIVE_CAPTION_BORDER

public static final int ACTIVE_CAPTION_BORDER
Enabled: The array index for the activeCaptionBorder system color.

See Also:
activeCaptionBorder

INACTIVE_CAPTION

public static final int INACTIVE_CAPTION
Enabled: The array index for the inactiveCaption system color.

See Also:
inactiveCaption

INACTIVE_CAPTION_TEXT

public static final int INACTIVE_CAPTION_TEXT
Enabled: The array index for the inactiveCaptionText system color.

See Also:
inactiveCaptionText

INACTIVE_CAPTION_BORDER

public static final int INACTIVE_CAPTION_BORDER
Enabled: The array index for the inactiveCaptionBorder system color.

See Also:
inactiveCaptionBorder

WINDOW

public static final int WINDOW
Enabled: The array index for the window system color.

See Also:
window

WINDOW_BORDER

public static final int WINDOW_BORDER
Enabled: The array index for the windowBorder system color.

See Also:
windowBorder

WINDOW_TEXT

public static final int WINDOW_TEXT
Enabled: The array index for the windowText system color.

See Also:
windowText

MENU

public static final int MENU
Enabled: The array index for the menu system color.

See Also:
menu

MENU_TEXT

public static final int MENU_TEXT
Enabled: The array index for the menuText system color.

See Also:
menuText

TEXT

public static final int TEXT
Enabled: The array index for the text system color.

See Also:
text

TEXT_TEXT

public static final int TEXT_TEXT
Enabled: The array index for the textText system color.

See Also:
textText

TEXT_HIGHLIGHT

public static final int TEXT_HIGHLIGHT
Enabled: The array index for the textHighlight system color.

See Also:
textHighlight

TEXT_HIGHLIGHT_TEXT

public static final int TEXT_HIGHLIGHT_TEXT
Enabled: The array index for the textHighlightText system color.

See Also:
textHighlightText

TEXT_INACTIVE_TEXT

public static final int TEXT_INACTIVE_TEXT
Enabled: The array index for the textInactiveText system color.

See Also:
textInactiveText

CONTROL

public static final int CONTROL
Enabled: The array index for the control system color.

See Also:
control

CONTROL_TEXT

public static final int CONTROL_TEXT
Enabled: The array index for the controlText system color.

See Also:
controlText

CONTROL_HIGHLIGHT

public static final int CONTROL_HIGHLIGHT
Enabled: The array index for the controlHighlight system color.

See Also:
controlHighlight

CONTROL_LT_HIGHLIGHT

public static final int CONTROL_LT_HIGHLIGHT
Enabled: The array index for the controlLtHighlight system color.

See Also:
controlLtHighlight

CONTROL_SHADOW

public static final int CONTROL_SHADOW
Enabled: The array index for the controlShadow system color.

See Also:
controlShadow

CONTROL_DK_SHADOW

public static final int CONTROL_DK_SHADOW
Enabled: The array index for the controlDkShadow system color.

See Also:
controlDkShadow

SCROLLBAR

public static final int SCROLLBAR
Enabled: The array index for the scrollbar system color.

See Also:
scrollbar

INFO

public static final int INFO
Enabled: The array index for the info system color.

See Also:
info

INFO_TEXT

public static final int INFO_TEXT
Enabled: The array index for the infoText system color.

See Also:
infoText

NUM_COLORS

public static final int NUM_COLORS
Enabled: The number of system colors in the array.


desktop

public static final SystemColor desktop
Enabled: The color rendered for the background of the desktop.


activeCaption

public static final SystemColor activeCaption
Enabled: The color rendered for the window-title background of the currently active window.


activeCaptionText

public static final SystemColor activeCaptionText
Enabled: The color rendered for the window-title text of the currently active window.


activeCaptionBorder

public static final SystemColor activeCaptionBorder
Enabled: The color rendered for the border around the currently active window.


inactiveCaption

public static final SystemColor inactiveCaption
Enabled: The color rendered for the window-title background of inactive windows.


inactiveCaptionText

public static final SystemColor inactiveCaptionText
Enabled: The color rendered for the window-title text of inactive windows.


inactiveCaptionBorder

public static final SystemColor inactiveCaptionBorder
Enabled: The color rendered for the border around inactive windows.


window

public static final SystemColor window
Enabled: The color rendered for the background of interior regions inside windows.


windowBorder

public static final SystemColor windowBorder
Enabled: The color rendered for the border around interior regions inside windows.


windowText

public static final SystemColor windowText
Enabled: The color rendered for text of interior regions inside windows.


menu

public static final SystemColor menu
Enabled: The color rendered for the background of menus.


menuText

public static final SystemColor menuText
Enabled: The color rendered for the text of menus.


text

public static final SystemColor text
Enabled: The color rendered for the background of text control objects, such as textfields and comboboxes.


textText

public static final SystemColor textText
Enabled: The color rendered for the text of text control objects, such as textfields and comboboxes.


textHighlight

public static final SystemColor textHighlight
Enabled: The color rendered for the background of selected items, such as in menus, comboboxes, and text.


textHighlightText

public static final SystemColor textHighlightText
Enabled: The color rendered for the text of selected items, such as in menus, comboboxes, and text.


textInactiveText

public static final SystemColor textInactiveText
Enabled: The color rendered for the text of inactive items, such as in menus.


control

public static final SystemColor control
Enabled: The color rendered for the background of control panels and control objects, such as pushbuttons.


controlText

public static final SystemColor controlText
Enabled: The color rendered for the text of control panels and control objects, such as pushbuttons.


controlHighlight

public static final SystemColor controlHighlight
Enabled: The color rendered for light areas of 3D control objects, such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.


controlLtHighlight

public static final SystemColor controlLtHighlight
Enabled: The color rendered for highlight areas of 3D control objects, such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.


controlShadow

public static final SystemColor controlShadow
Enabled: The color rendered for shadow areas of 3D control objects, such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.


controlDkShadow

public static final SystemColor controlDkShadow
Enabled: The color rendered for dark shadow areas on 3D control objects, such as pushbuttons. This color is typically derived from the control background color to provide a 3D effect.


scrollbar

public static final SystemColor scrollbar
Enabled: The color rendered for the background of scrollbars.


info

public static final SystemColor info
Enabled: The color rendered for the background of tooltips or spot help.


infoText

public static final SystemColor infoText
Enabled: The color rendered for the text of tooltips or spot help.


systemColors

private static int[] systemColors

serialVersionUID

private static final long serialVersionUID
Constructor Detail

SystemColor

private SystemColor(byte index)
Creates a symbolic color that represents an indexed entry into system color cache. Used by above static system colors.

Method Detail

updateSystemColors

private static void updateSystemColors()
Called from & toolkit to update the above systemColors cache.


getRGB

public int getRGB()
Enabled: Gets the "current" RGB value representing the symbolic color. (Bits 24-31 are 0xff, 16-23 are red, 8-15 are green, 0-7 are blue).

Overrides:
getRGB in class Color
Returns:
the RGB value of the color in the default sRGB ColorModel.
See Also:
java.awt.image.ColorModel#getRGBdefault, java.awt.Color#getBlue(), java.awt.Color#getGreen(), java.awt.Color#getRed()

createContext

public PaintContext createContext(java.awt.image.ColorModel cm,
                                  Rectangle r,
                                  java.awt.geom.Rectangle2D r2d,
                                  java.awt.geom.AffineTransform xform,
                                  RenderingHints hints)
Enabled: Creates and returns a PaintContext used to generate a solid color pattern. This enables a Color object to be used as an argument to any method requiring an object implementing the Paint interface.

Specified by:
createContext in interface Paint
Overrides:
createContext in class Color
Parameters:
cm - the specified ColorModel
r - the specified Rectangle
r2d - the specified Rectangle2D
xform - the specified AffineTransform
hints - the specified RenderingHints
Returns:
a PaintContext that is used to generate a solid color pattern.
See Also:
Paint, PaintContext, Graphics2D.setPaint(java.awt.Paint)

toString

public String toString()
Suppressed: Returns a string representation of this Color's values. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
toString in class Color
Returns:
a string representation of this Color


comments?