SystemColor (Java 2 Platform SE 5.0) (original) (raw)


java.awt

Class SystemColor

java.lang.Object extended by java.awt.Color extended by java.awt.SystemColor

All Implemented Interfaces:

Paint, Transparency, Serializable


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 aSystemColor 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 Also:

Toolkit.getDesktopProperty(java.lang.String), Serialized Form


Field Summary
static int ACTIVE_CAPTION The array index for theactiveCaption system color.
static int ACTIVE_CAPTION_BORDER The array index for theactiveCaptionBorder system color.
static int ACTIVE_CAPTION_TEXT The array index for theactiveCaptionText system color.
static SystemColor activeCaption The color rendered for the window-title background of the currently active window.
static SystemColor activeCaptionBorder The color rendered for the border around the currently active window.
static SystemColor activeCaptionText The color rendered for the window-title text of the currently active window.
static SystemColor control The color rendered for the background of control panels and control objects, such as pushbuttons.
static int CONTROL The array index for thecontrol system color.
static int CONTROL_DK_SHADOW The array index for thecontrolDkShadow system color.
static int CONTROL_HIGHLIGHT The array index for thecontrolHighlight system color.
static int CONTROL_LT_HIGHLIGHT The array index for thecontrolLtHighlight system color.
static int CONTROL_SHADOW The array index for thecontrolShadow system color.
static int CONTROL_TEXT The array index for thecontrolText system color.
static SystemColor controlDkShadow The color rendered for dark shadow areas on 3D control objects, such as pushbuttons.
static SystemColor controlHighlight The color rendered for light areas of 3D control objects, such as pushbuttons.
static SystemColor controlLtHighlight The color rendered for highlight areas of 3D control objects, such as pushbuttons.
static SystemColor controlShadow The color rendered for shadow areas of 3D control objects, such as pushbuttons.
static SystemColor controlText The color rendered for the text of control panels and control objects, such as pushbuttons.
static SystemColor desktop The color rendered for the background of the desktop.
static int DESKTOP The array index for thedesktop system color.
static int INACTIVE_CAPTION The array index for theinactiveCaption system color.
static int INACTIVE_CAPTION_BORDER The array index for theinactiveCaptionBorder system color.
static int INACTIVE_CAPTION_TEXT The array index for theinactiveCaptionText system color.
static SystemColor inactiveCaption The color rendered for the window-title background of inactive windows.
static SystemColor inactiveCaptionBorder The color rendered for the border around inactive windows.
static SystemColor inactiveCaptionText The color rendered for the window-title text of inactive windows.
static SystemColor info The color rendered for the background of tooltips or spot help.
static int INFO The array index for theinfo system color.
static int INFO_TEXT The array index for theinfoText system color.
static SystemColor infoText The color rendered for the text of tooltips or spot help.
static SystemColor menu The color rendered for the background of menus.
static int MENU The array index for themenu system color.
static int MENU_TEXT The array index for themenuText system color.
static SystemColor menuText The color rendered for the text of menus.
static int NUM_COLORS The number of system colors in the array.
static SystemColor scrollbar The color rendered for the background of scrollbars.
static int SCROLLBAR The array index for thescrollbar system color.
static SystemColor text The color rendered for the background of text control objects, such as textfields and comboboxes.
static int TEXT The array index for thetext system color.
static int TEXT_HIGHLIGHT The array index for thetextHighlight system color.
static int TEXT_HIGHLIGHT_TEXT The array index for thetextHighlightText system color.
static int TEXT_INACTIVE_TEXT The array index for thetextInactiveText system color.
static int TEXT_TEXT The array index for thetextText system color.
static SystemColor textHighlight The color rendered for the background of selected items, such as in menus, comboboxes, and text.
static SystemColor textHighlightText The color rendered for the text of selected items, such as in menus, comboboxes, and text.
static SystemColor textInactiveText The color rendered for the text of inactive items, such as in menus.
static SystemColor textText The color rendered for the text of text control objects, such as textfields and comboboxes.
static SystemColor window The color rendered for the background of interior regions inside windows.
static int WINDOW The array index for thewindow system color.
static int WINDOW_BORDER The array index for thewindowBorder system color.
static int WINDOW_TEXT The array index for thewindowText system color.
static SystemColor windowBorder The color rendered for the border around interior regions inside windows.
static SystemColor windowText 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, white, WHITE, yellow, YELLOW
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
Method Summary
PaintContext [createContext](../../java/awt/SystemColor.html#createContext%28java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints%29)(ColorModel cm,Rectangle r,Rectangle2D r2d,AffineTransform xform,RenderingHints hints) Creates and returns a PaintContext used to generate a solid color pattern.
int getRGB() Gets the "current" RGB value representing the symbolic color.
String toString() Returns a string representation of this Color's values.
Methods inherited from class java.awt.Color
brighter, darker, decode, equals, getAlpha, getBlue, getColor, [getColor](../../java/awt/Color.html#getColor%28java.lang.String, java.awt.Color%29), [getColor](../../java/awt/Color.html#getColor%28java.lang.String, int%29), [getColorComponents](../../java/awt/Color.html#getColorComponents%28java.awt.color.ColorSpace, float[]%29), getColorComponents, getColorSpace, [getComponents](../../java/awt/Color.html#getComponents%28java.awt.color.ColorSpace, float[]%29), getComponents, getGreen, [getHSBColor](../../java/awt/Color.html#getHSBColor%28float, float, float%29), getRed, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, [HSBtoRGB](../../java/awt/Color.html#HSBtoRGB%28float, float, float%29), [RGBtoHSB](../../java/awt/Color.html#RGBtoHSB%28int, int, int, float[]%29)
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, [wait](../../java/lang/Object.html#wait%28long, int%29)
Field Detail

DESKTOP

public static final int DESKTOP

The array index for thedesktop system color.

See Also:

desktop, Constant Field Values


ACTIVE_CAPTION

public static final int ACTIVE_CAPTION

The array index for theactiveCaption system color.

See Also:

activeCaption, Constant Field Values


ACTIVE_CAPTION_TEXT

public static final int ACTIVE_CAPTION_TEXT

The array index for theactiveCaptionText system color.

See Also:

activeCaptionText, Constant Field Values


ACTIVE_CAPTION_BORDER

public static final int ACTIVE_CAPTION_BORDER

The array index for theactiveCaptionBorder system color.

See Also:

activeCaptionBorder, Constant Field Values


INACTIVE_CAPTION

public static final int INACTIVE_CAPTION

The array index for theinactiveCaption system color.

See Also:

inactiveCaption, Constant Field Values


INACTIVE_CAPTION_TEXT

public static final int INACTIVE_CAPTION_TEXT

The array index for theinactiveCaptionText system color.

See Also:

inactiveCaptionText, Constant Field Values


INACTIVE_CAPTION_BORDER

public static final int INACTIVE_CAPTION_BORDER

The array index for theinactiveCaptionBorder system color.

See Also:

inactiveCaptionBorder, Constant Field Values


WINDOW

public static final int WINDOW

The array index for thewindow system color.

See Also:

window, Constant Field Values


WINDOW_BORDER

public static final int WINDOW_BORDER

The array index for thewindowBorder system color.

See Also:

windowBorder, Constant Field Values


WINDOW_TEXT

public static final int WINDOW_TEXT

The array index for thewindowText system color.

See Also:

windowText, Constant Field Values


public static final int MENU

The array index for themenu system color.

See Also:

menu, Constant Field Values


public static final int MENU_TEXT

The array index for themenuText system color.

See Also:

menuText, Constant Field Values


TEXT

public static final int TEXT

The array index for thetext system color.

See Also:

text, Constant Field Values


TEXT_TEXT

public static final int TEXT_TEXT

The array index for thetextText system color.

See Also:

textText, Constant Field Values


TEXT_HIGHLIGHT

public static final int TEXT_HIGHLIGHT

The array index for thetextHighlight system color.

See Also:

textHighlight, Constant Field Values


TEXT_HIGHLIGHT_TEXT

public static final int TEXT_HIGHLIGHT_TEXT

The array index for thetextHighlightText system color.

See Also:

textHighlightText, Constant Field Values


TEXT_INACTIVE_TEXT

public static final int TEXT_INACTIVE_TEXT

The array index for thetextInactiveText system color.

See Also:

textInactiveText, Constant Field Values


CONTROL

public static final int CONTROL

The array index for thecontrol system color.

See Also:

control, Constant Field Values


CONTROL_TEXT

public static final int CONTROL_TEXT

The array index for thecontrolText system color.

See Also:

controlText, Constant Field Values


CONTROL_HIGHLIGHT

public static final int CONTROL_HIGHLIGHT

The array index for thecontrolHighlight system color.

See Also:

controlHighlight, Constant Field Values


CONTROL_LT_HIGHLIGHT

public static final int CONTROL_LT_HIGHLIGHT

The array index for thecontrolLtHighlight system color.

See Also:

controlLtHighlight, Constant Field Values


CONTROL_SHADOW

public static final int CONTROL_SHADOW

The array index for thecontrolShadow system color.

See Also:

controlShadow, Constant Field Values


CONTROL_DK_SHADOW

public static final int CONTROL_DK_SHADOW

The array index for thecontrolDkShadow system color.

See Also:

controlDkShadow, Constant Field Values


SCROLLBAR

public static final int SCROLLBAR

The array index for thescrollbar system color.

See Also:

scrollbar, Constant Field Values


INFO

public static final int INFO

The array index for theinfo system color.

See Also:

info, Constant Field Values


INFO_TEXT

public static final int INFO_TEXT

The array index for theinfoText system color.

See Also:

infoText, Constant Field Values


NUM_COLORS

public static final int NUM_COLORS

The number of system colors in the array.

See Also:

Constant Field Values


desktop

public static final SystemColor desktop

The color rendered for the background of the desktop.


activeCaption

public static final SystemColor activeCaption

The color rendered for the window-title background of the currently active window.


activeCaptionText

public static final SystemColor activeCaptionText

The color rendered for the window-title text of the currently active window.


activeCaptionBorder

public static final SystemColor activeCaptionBorder

The color rendered for the border around the currently active window.


inactiveCaption

public static final SystemColor inactiveCaption

The color rendered for the window-title background of inactive windows.


inactiveCaptionText

public static final SystemColor inactiveCaptionText

The color rendered for the window-title text of inactive windows.


inactiveCaptionBorder

public static final SystemColor inactiveCaptionBorder

The color rendered for the border around inactive windows.


window

public static final SystemColor window

The color rendered for the background of interior regions inside windows.


windowBorder

public static final SystemColor windowBorder

The color rendered for the border around interior regions inside windows.


windowText

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.


text

public static final SystemColor text

The color rendered for the background of text control objects, such as textfields and comboboxes.


textText

public static final SystemColor textText

The color rendered for the text of text control objects, such as textfields and comboboxes.


textHighlight

public static final SystemColor textHighlight

The color rendered for the background of selected items, such as in menus, comboboxes, and text.


textHighlightText

public static final SystemColor textHighlightText

The color rendered for the text of selected items, such as in menus, comboboxes, and text.


textInactiveText

public static final SystemColor textInactiveText

The color rendered for the text of inactive items, such as in menus.


control

public static final SystemColor control

The color rendered for the background of control panels and control objects, such as pushbuttons.


controlText

public static final SystemColor controlText

The color rendered for the text of control panels and control objects, such as pushbuttons.


controlHighlight

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.


controlLtHighlight

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.


controlShadow

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.


controlDkShadow

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.


scrollbar

public static final SystemColor scrollbar

The color rendered for the background of scrollbars.


info

public static final SystemColor info

The color rendered for the background of tooltips or spot help.


infoText

public static final SystemColor infoText

The color rendered for the text of tooltips or spot help.

Method Detail

getRGB

public int getRGB()

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](../../java/awt/Color.html#getRGB%28%29) in class [Color](../../java/awt/Color.html "class in java.awt")

Returns:

the RGB value of the color in the default sRGBColorModel.

See Also:

ColorModel.getRGBdefault(), Color.getBlue(), Color.getGreen(), Color.getRed()


createContext

public PaintContext createContext(ColorModel cm, Rectangle r, Rectangle2D r2d, AffineTransform xform, 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.

Specified by:

[createContext](../../java/awt/Paint.html#createContext%28java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints%29) in interface [Paint](../../java/awt/Paint.html "interface in java.awt")

Overrides:

[createContext](../../java/awt/Color.html#createContext%28java.awt.image.ColorModel, java.awt.Rectangle, java.awt.geom.Rectangle2D, java.awt.geom.AffineTransform, java.awt.RenderingHints%29) in class [Color](../../java/awt/Color.html "class in java.awt")

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()

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](../../java/awt/Color.html#toString%28%29) in class [Color](../../java/awt/Color.html "class in java.awt")

Returns:

a string representation of this Color



Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.