FileDocCategorySizeDatePackage
SystemColor.javaAPI DocJava SE 6 API15322Tue Jun 10 00:25:18 BST 2008java.awt

SystemColor

public final class SystemColor extends Color implements Serializable
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.

see
Toolkit#getDesktopProperty
version
1.26, 08/06/06
author
Carl Quinn
author
Amy Fowler

Fields Summary
public static final int
DESKTOP
The array index for the {@link #desktop} system color.
public static final int
ACTIVE_CAPTION
The array index for the {@link #activeCaption} system color.
public static final int
ACTIVE_CAPTION_TEXT
The array index for the {@link #activeCaptionText} system color.
public static final int
ACTIVE_CAPTION_BORDER
The array index for the {@link #activeCaptionBorder} system color.
public static final int
INACTIVE_CAPTION
The array index for the {@link #inactiveCaption} system color.
public static final int
INACTIVE_CAPTION_TEXT
The array index for the {@link #inactiveCaptionText} system color.
public static final int
INACTIVE_CAPTION_BORDER
The array index for the {@link #inactiveCaptionBorder} system color.
public static final int
WINDOW
The array index for the {@link #window} system color.
public static final int
WINDOW_BORDER
The array index for the {@link #windowBorder} system color.
public static final int
WINDOW_TEXT
The array index for the {@link #windowText} system color.
public static final int
MENU
The array index for the {@link #menu} system color.
public static final int
MENU_TEXT
The array index for the {@link #menuText} system color.
public static final int
TEXT
The array index for the {@link #text} system color.
public static final int
TEXT_TEXT
The array index for the {@link #textText} system color.
public static final int
TEXT_HIGHLIGHT
The array index for the {@link #textHighlight} system color.
public static final int
TEXT_HIGHLIGHT_TEXT
The array index for the {@link #textHighlightText} system color.
public static final int
TEXT_INACTIVE_TEXT
The array index for the {@link #textInactiveText} system color.
public static final int
CONTROL
The array index for the {@link #control} system color.
public static final int
CONTROL_TEXT
The array index for the {@link #controlText} system color.
public static final int
CONTROL_HIGHLIGHT
The array index for the {@link #controlHighlight} system color.
public static final int
CONTROL_LT_HIGHLIGHT
The array index for the {@link #controlLtHighlight} system color.
public static final int
CONTROL_SHADOW
The array index for the {@link #controlShadow} system color.
public static final int
CONTROL_DK_SHADOW
The array index for the {@link #controlDkShadow} system color.
public static final int
SCROLLBAR
The array index for the {@link #scrollbar} system color.
public static final int
INFO
The array index for the {@link #info} system color.
public static final int
INFO_TEXT
The array index for the {@link #infoText} system color.
public static final int
NUM_COLORS
The number of system colors in the array.
public static final SystemColor
desktop
/ /** The color rendered for the background of the desktop.
public static final SystemColor
activeCaption
The color rendered for the window-title background of the currently active window.
public static final SystemColor
activeCaptionText
The color rendered for the window-title text of the currently active window.
public static final SystemColor
activeCaptionBorder
The color rendered for the border around the currently active window.
public static final SystemColor
inactiveCaption
The color rendered for the window-title background of inactive windows.
public static final SystemColor
inactiveCaptionText
The color rendered for the window-title text of inactive windows.
public static final SystemColor
inactiveCaptionBorder
The color rendered for the border around inactive windows.
public static final SystemColor
window
The color rendered for the background of interior regions inside windows.
public static final SystemColor
windowBorder
The color rendered for the border around interior regions inside windows.
public static final SystemColor
windowText
The color rendered for text of interior regions inside windows.
public static final SystemColor
menu
The color rendered for the background of menus.
public static final SystemColor
menuText
The color rendered for the text of menus.
public static final SystemColor
text
The color rendered for the background of text control objects, such as textfields and comboboxes.
public static final SystemColor
textText
The color rendered for the text of text control objects, such as textfields and comboboxes.
public static final SystemColor
textHighlight
The color rendered for the background of selected items, such as in menus, comboboxes, and text.
public static final SystemColor
textHighlightText
The color rendered for the text of selected items, such as in menus, comboboxes, and text.
public static final SystemColor
textInactiveText
The color rendered for the text of inactive items, such as in menus.
public static final SystemColor
control
The color rendered for the background of control panels and control objects, such as pushbuttons.
public static final SystemColor
controlText
The color rendered for the text of control panels and control objects, such as pushbuttons.
public static final SystemColor
controlHighlight
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.
public static final SystemColor
controlLtHighlight
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.
public static final SystemColor
controlShadow
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.
public static final SystemColor
controlDkShadow
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.
public static final SystemColor
scrollbar
The color rendered for the background of scrollbars.
public static final SystemColor
info
The color rendered for the background of tooltips or spot help.
public static final SystemColor
infoText
The color rendered for the text of tooltips or spot help.
private static int[]
systemColors
private static final long
serialVersionUID
Constructors Summary
private SystemColor(byte index)
Creates a symbolic color that represents an indexed entry into system color cache. Used by above static system colors.

        super(0, 0, 0);
	value = index;
    
Methods Summary
public java.awt.PaintContextcreateContext(java.awt.image.ColorModel cm, java.awt.Rectangle r, java.awt.geom.Rectangle2D r2d, java.awt.geom.AffineTransform xform, java.awt.RenderingHints hints)
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.

see
Paint
see
PaintContext
see
Graphics2D#setPaint

	return new ColorPaintContext(value, cm);
    
public intgetRGB()
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).

see
java.awt.image.ColorModel#getRGBdefault
see
java.awt.Color#getBlue()
see
java.awt.Color#getGreen()
see
java.awt.Color#getRed()

	return systemColors[value];
    
public java.lang.StringtoString()
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.

return
a string representation of this Color

        return getClass().getName() + "[i=" + (value) + "]";
    
private static voidupdateSystemColors()
Called from & toolkit to update the above systemColors cache.


     
      updateSystemColors();
    
        if (!GraphicsEnvironment.isHeadless()) {
            Toolkit.getDefaultToolkit().loadSystemColors(systemColors);
        }