java.awt

Class SystemColor

Implemented Interfaces:
Paint, Serializable, Transparency

public final class SystemColor
extends Color
implements Serializable

This class contains the various "system colors" in use by the native windowing system. The getRGB() method is dynamic on systems which support dynamic system color changes, and most methods in the superclass are written to use this dynamic value when reporting colors. However, the equals() method is not dynamic, and does not track the actual color of instances in this class. This means that equals may give surprising results; you are better off relying on getRGB.
Since:
1.1
See Also:
Serialized Form

Field Summary

static int
ACTIVE_CAPTION
Array index of the active caption color.
static int
ACTIVE_CAPTION_BORDER
Array index of the active caption border color.
static int
ACTIVE_CAPTION_TEXT
Array index of the active caption text color.
static int
CONTROL
Array index of the control background color.
static int
CONTROL_DK_SHADOW
Array index of the darkly shadowed control background color.
static int
CONTROL_HIGHLIGHT
Array index of the highlighted control background color.
static int
CONTROL_LT_HIGHLIGHT
Array index of the lightly highlighted control background color.
static int
CONTROL_SHADOW
Array index of the shadowed control background color.
static int
CONTROL_TEXT
Array index of the control text color.
static int
DESKTOP
Array index of the desktop color.
static int
INACTIVE_CAPTION
Array index of the inactive caption color.
static int
INACTIVE_CAPTION_BORDER
Array index of the inactive caption border color.
static int
INACTIVE_CAPTION_TEXT
Array index of the inactive caption text color.
static int
INFO
Array index of the info background color.
static int
INFO_TEXT
Array index of the info text color.
static int
MENU
Array index of the menu background color.
static int
MENU_TEXT
Array index of the menu text color.
static int
NUM_COLORS
The number of system colors.
static int
SCROLLBAR
Array index of the scrollbar background color.
static int
TEXT
Array index of the text background color.
static int
TEXT_HIGHLIGHT
Array index of the highlighted text background color.
static int
TEXT_HIGHLIGHT_TEXT
Array index of the highlighted text foreground color.
static int
TEXT_INACTIVE_TEXT
Array index of the inactive text foreground color.
static int
TEXT_TEXT
Array index of the text foreground color.
static int
WINDOW
Array index of the window background color.
static int
WINDOW_BORDER
Array index of the window border color.
static int
WINDOW_TEXT
Array index of the window text color.
static SystemColor
activeCaption
The active caption background color.
static SystemColor
activeCaptionBorder
The active caption border color.
static SystemColor
activeCaptionText
The active caption text color.
static SystemColor
control
The control background color.
static SystemColor
controlDkShadow
The control dark shadow color.
static SystemColor
controlHighlight
The control highlight color.
static SystemColor
controlLtHighlight
The control light highlight color.
static SystemColor
controlShadow
The control shadow color.
static SystemColor
controlText
The control text color.
static SystemColor
desktop
The desktop color.
static SystemColor
inactiveCaption
The inactive caption background color.
static SystemColor
inactiveCaptionBorder
The inactive caption border color.
static SystemColor
inactiveCaptionText
The inactive caption text color.
static SystemColor
info
The info text background color.
static SystemColor
infoText
The info text foreground color.
static SystemColor
menu
The menu background color.
static SystemColor
menuText
The menu text color.
static SystemColor
scrollbar
The scrollbar color.
static SystemColor
text
The text background color.
static SystemColor
textHighlight
The highlighted text background color.
static SystemColor
textHighlightText
The highlighted text foreground color.
static SystemColor
textInactiveText
The inactive text color.
static SystemColor
textText
The text foreground color.
static SystemColor
window
The window background color.
static SystemColor
windowBorder
The window border color.
static SystemColor
windowText
The window text color.

Fields inherited from class java.awt.Color

BLACK, BLUE, CYAN, DARK_GRAY, GRAY, GREEN, LIGHT_GRAY, MAGENTA, ORANGE, PINK, RED, WHITE, YELLOW, black, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellow

Fields inherited from interface java.awt.Transparency

BITMASK, OPAQUE, TRANSLUCENT

Method Summary

PaintContext
createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
Returns a paint context, used for filling areas of a raster scan with the current value of this system color.
int
getRGB()
Returns the RGB value for this color, in the sRGB color space.
String
toString()
Returns a string describing this color.

Methods inherited from class java.awt.Color

HSBtoRGB, RGBtoHSB, brighter, createContext, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRGB, getRGBColorComponents, getRGBComponents, getRed, getTransparency, hashCode, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

ACTIVE_CAPTION

public static final int ACTIVE_CAPTION
Array index of the active caption color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
1
See Also:
activeCaption

ACTIVE_CAPTION_BORDER

public static final int ACTIVE_CAPTION_BORDER
Array index of the active caption border color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
3

ACTIVE_CAPTION_TEXT

public static final int ACTIVE_CAPTION_TEXT
Array index of the active caption text color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
2

CONTROL

public static final int CONTROL
Array index of the control background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
17
See Also:
control

CONTROL_DK_SHADOW

public static final int CONTROL_DK_SHADOW
Array index of the darkly shadowed control background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
22

CONTROL_HIGHLIGHT

public static final int CONTROL_HIGHLIGHT
Array index of the highlighted control background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
19

CONTROL_LT_HIGHLIGHT

public static final int CONTROL_LT_HIGHLIGHT
Array index of the lightly highlighted control background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
20

CONTROL_SHADOW

public static final int CONTROL_SHADOW
Array index of the shadowed control background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
21
See Also:
controlShadow

CONTROL_TEXT

public static final int CONTROL_TEXT
Array index of the control text color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
18
See Also:
controlText

DESKTOP

public static final int DESKTOP
Array index of the desktop color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
0
See Also:
desktop

INACTIVE_CAPTION

public static final int INACTIVE_CAPTION
Array index of the inactive caption color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
4

INACTIVE_CAPTION_BORDER

public static final int INACTIVE_CAPTION_BORDER
Array index of the inactive caption border color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
6

INACTIVE_CAPTION_TEXT

public static final int INACTIVE_CAPTION_TEXT
Array index of the inactive caption text color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
5

INFO

public static final int INFO
Array index of the info background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
24
See Also:
info

INFO_TEXT

public static final int INFO_TEXT
Array index of the info text color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
25
See Also:
infoText

MENU

public static final int MENU
Array index of the menu background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
10
See Also:
menu

MENU_TEXT

public static final int MENU_TEXT
Array index of the menu text color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
11
See Also:
menuText

NUM_COLORS

public static final int NUM_COLORS
The number of system colors. Used by Toolkit.loadSystemColors(int[]).
Field Value:
26

SCROLLBAR

public static final int SCROLLBAR
Array index of the scrollbar background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
23
See Also:
scrollbar

TEXT

public static final int TEXT
Array index of the text background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
12
See Also:
text

TEXT_HIGHLIGHT

public static final int TEXT_HIGHLIGHT
Array index of the highlighted text background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
14
See Also:
textHighlight

TEXT_HIGHLIGHT_TEXT

public static final int TEXT_HIGHLIGHT_TEXT
Array index of the highlighted text foreground color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
15

TEXT_INACTIVE_TEXT

public static final int TEXT_INACTIVE_TEXT
Array index of the inactive text foreground color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
16

TEXT_TEXT

public static final int TEXT_TEXT
Array index of the text foreground color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
13
See Also:
textText

WINDOW

public static final int WINDOW
Array index of the window background color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
7
See Also:
window

WINDOW_BORDER

public static final int WINDOW_BORDER
Array index of the window border color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
8
See Also:
windowBorder

WINDOW_TEXT

public static final int WINDOW_TEXT
Array index of the window text color. Used by Toolkit.loadSystemColors(int[]).
Field Value:
9
See Also:
windowText

activeCaption

public static final SystemColor activeCaption
The active caption background color.

activeCaptionBorder

public static final SystemColor activeCaptionBorder
The active caption border color.

activeCaptionText

public static final SystemColor activeCaptionText
The active caption text color.

control

public static final SystemColor control
The control background color.

controlDkShadow

public static final SystemColor controlDkShadow
The control dark shadow color.

controlHighlight

public static final SystemColor controlHighlight
The control highlight color.

controlLtHighlight

public static final SystemColor controlLtHighlight
The control light highlight color.

controlShadow

public static final SystemColor controlShadow
The control shadow color.

controlText

public static final SystemColor controlText
The control text color.

desktop

public static final SystemColor desktop
The desktop color.

inactiveCaption

public static final SystemColor inactiveCaption
The inactive caption background color.

inactiveCaptionBorder

public static final SystemColor inactiveCaptionBorder
The inactive caption border color.

inactiveCaptionText

public static final SystemColor inactiveCaptionText
The inactive caption text color.

info

public static final SystemColor info
The info text background color.

infoText

public static final SystemColor infoText
The info text foreground color.

menu

public static final SystemColor menu
The menu background color.

menuText

public static final SystemColor menuText
The menu text color.

scrollbar

public static final SystemColor scrollbar
The scrollbar color.

text

public static final SystemColor text
The text background color.

textHighlight

public static final SystemColor textHighlight
The highlighted text background color.

textHighlightText

public static final SystemColor textHighlightText
The highlighted text foreground color.

textInactiveText

public static final SystemColor textInactiveText
The inactive text color.

textText

public static final SystemColor textText
The text foreground color.

window

public static final SystemColor window
The window background color.

windowBorder

public static final SystemColor windowBorder
The window border color.

windowText

public static final SystemColor windowText
The window text color.

Method Details

createContext

public PaintContext createContext(ColorModel cm,
                                  Rectangle deviceBounds,
                                  Rectangle2D userBounds,
                                  AffineTransform xform,
                                  RenderingHints hints)
Returns a paint context, used for filling areas of a raster scan with the current value of this system color. Since the system colors may be dynamically updated, the returned value may not always be the same; but as the system color is solid, the context does not need any of the passed parameters to do its job.
Specified by:
createContext in interface Paint
Overrides:
createContext in interface Color
Parameters:
cm - the requested color model
deviceBounds - the bounding box in device coordinates, ignored
userBounds - the bounding box in user coordinates, ignored
xform - the bounds transformation, ignored
hints - any rendering hints, ignored
Returns:
a context for painting this solid color

getRGB

public int getRGB()
Returns the RGB value for this color, in the sRGB color space. The blue value will be in bits 0-7, green in 8-15, red in 6-23, and the alpha value (bits 24-31) is 0xff. This is dynamically updated, so it may not match the results of getRed(), getGreen(), or getBlue().
Overrides:
getRGB in interface Color
Returns:
the current RGB value

toString

public String toString()
Returns a string describing this color. This is in the format "java.awt.SystemColor[i=" + index + ']', where index is one of the integer constants of this class. Unfortunately, this description does not describe the current value of the color; for that you should use new Color(syscolor.getRGB()).toString().
Overrides:
toString in interface Color
Returns:
a string describing this color

SystemColor.java -- access dynamic system color values Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.