APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt

public final Class SystemColor

extends Color
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.ObjectStreamException, .Serial, java.lang.annotation.Native, sun.awt.AWTAccessor

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.

Authors
Carl Quinn, Amy Fowler
See Also
Toolkit#getDesktopProperty

Field Summary

Modifier and TypeField and Description
public static final int
ACTIVE_CAPTION

The array index for the activeCaption system color.

public static final int
ACTIVE_CAPTION_BORDER

The array index for the activeCaptionBorder system color.

public static final int
ACTIVE_CAPTION_TEXT

The array index for the activeCaptionText system color.

public static final SystemColor
activeCaption

The color rendered for the window-title background 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
activeCaptionText

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

public static final int
CONTROL

The array index for the control system color.

public static final SystemColor
control

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

public static final int
CONTROL_DK_SHADOW

The array index for the controlDkShadow system color.

public static final int
CONTROL_HIGHLIGHT

The array index for the controlHighlight system color.

public static final int
CONTROL_LT_HIGHLIGHT

The array index for the controlLtHighlight system color.

public static final int
CONTROL_SHADOW

The array index for the controlShadow system color.

public static final int
CONTROL_TEXT

The array index for the controlText system color.

public static final SystemColor
controlDkShadow

The color rendered for dark shadow areas on 3D control objects, such as pushbuttons.

public static final SystemColor
controlHighlight

The color rendered for light areas of 3D control objects, such as pushbuttons.

public static final SystemColor
controlLtHighlight

The color rendered for highlight areas of 3D control objects, such as pushbuttons.

public static final SystemColor
controlShadow

The color rendered for shadow areas of 3D 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 int
DESKTOP

The array index for the desktop system color.

public static final SystemColor
desktop

The color rendered for the background of the desktop.

public static final int
INACTIVE_CAPTION

The array index for the inactiveCaption system color.

public static final int
INACTIVE_CAPTION_BORDER

The array index for the inactiveCaptionBorder system color.

public static final int
INACTIVE_CAPTION_TEXT

The array index for the inactiveCaptionText system color.

public static final SystemColor
inactiveCaption

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

public static final SystemColor
inactiveCaptionBorder

The color rendered for the border around inactive windows.

public static final SystemColor
inactiveCaptionText

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

private transient int
public static final int
INFO

The array index for the info system color.

public static final SystemColor
info

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

public static final int
INFO_TEXT

The array index for the infoText system color.

public static final SystemColor
infoText

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

public static final int
NUM_COLORS

The number of system colors in the array.

public static final int
SCROLLBAR

The array index for the scrollbar system color.

public static final SystemColor
scrollbar

The color rendered for the background of scrollbars.

private static final long
serialVersionUID

Hides java.awt.Color.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.
private static SystemColor[]
private static int[]
public static final int
TEXT

The array index for the text system color.

public static final SystemColor
text

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

public static final int
TEXT_HIGHLIGHT

The array index for the textHighlight system color.

public static final int
TEXT_HIGHLIGHT_TEXT

The array index for the textHighlightText system color.

public static final int
TEXT_INACTIVE_TEXT

The array index for the textInactiveText system color.

public static final int
TEXT_TEXT

The array index for the textText system color.

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
textText

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

public static final int
WINDOW

The array index for the window system color.

public static final SystemColor
window

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

public static final int
WINDOW_BORDER

The array index for the windowBorder system color.

public static final int
WINDOW_TEXT

The array index for the windowText system color.

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.

Inherited from java.awt.Color:
blackBLACKblueBLUEcyanCYANDARK_GRAYdarkGraygrayGRAYgreenGREENLIGHT_GRAYlightGraymagentaMAGENTAorangeORANGEpinkPINKredREDvaluewhiteWHITEyellowYELLOW

Constructor Summary

AccessConstructor and Description
private
SystemColor(byte index)

Creates a symbolic color that represents an indexed entry into system color cache.

Method Summary

Modifier and TypeMethod and Description
private Object

Returns:

one of the SystemColor static object fields that refers to the same system color.
readResolve
()

The design of the SystemColor class assumes that the SystemColor object instances stored in the static final fields above are the only instances that can be used by developers.

public String

Returns:

a string representation of this Color
toString
()

Overrides java.awt.Color.toString.

Returns a string representation of this Color's values.

private static void
updateSystemColors()

Called from <init> and toolkit to update the above systemColors cache.

private Object

Returns:

a proxy SystemColor object with its value replaced by the corresponding system color index.
writeReplace
()

Returns a specialized version of the SystemColor object for writing to the serialized stream.

Inherited from java.awt.Color:
brightercreateContextdarkerdecodeequalsgetAlphagetBluegetColorgetColorgetColorgetColorComponentsgetColorComponentsgetColorSpacegetComponentsgetComponentsgetGreengetHSBColorgetRedgetRGBgetRGBColorComponentsgetRGBComponentsgetTransparencyhashCodeHSBtoRGBRGBtoHSB

Field Detail

ACTIVE_CAPTIONback to summary
public static final int ACTIVE_CAPTION

The array index for the activeCaption system color.

Annotations
@Native
See Also
SystemColor#activeCaption
ACTIVE_CAPTION_BORDERback to summary
public static final int ACTIVE_CAPTION_BORDER

The array index for the activeCaptionBorder system color.

Annotations
@Native
See Also
SystemColor#activeCaptionBorder
ACTIVE_CAPTION_TEXTback to summary
public static final int ACTIVE_CAPTION_TEXT

The array index for the activeCaptionText system color.

Annotations
@Native
See Also
SystemColor#activeCaptionText
activeCaptionback to summary
public static final SystemColor activeCaption

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

activeCaptionBorderback to summary
public static final SystemColor activeCaptionBorder

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

activeCaptionTextback to summary
public static final SystemColor activeCaptionText

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

CONTROLback to summary
public static final int CONTROL

The array index for the control system color.

Annotations
@Native
See Also
SystemColor#control
controlback to summary
public static final SystemColor control

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

CONTROL_DK_SHADOWback to summary
public static final int CONTROL_DK_SHADOW

The array index for the controlDkShadow system color.

Annotations
@Native
See Also
SystemColor#controlDkShadow
CONTROL_HIGHLIGHTback to summary
public static final int CONTROL_HIGHLIGHT

The array index for the controlHighlight system color.

Annotations
@Native
See Also
SystemColor#controlHighlight
CONTROL_LT_HIGHLIGHTback to summary
public static final int CONTROL_LT_HIGHLIGHT

The array index for the controlLtHighlight system color.

Annotations
@Native
See Also
SystemColor#controlLtHighlight
CONTROL_SHADOWback to summary
public static final int CONTROL_SHADOW

The array index for the controlShadow system color.

Annotations
@Native
See Also
SystemColor#controlShadow
CONTROL_TEXTback to summary
public static final int CONTROL_TEXT

The array index for the controlText system color.

Annotations
@Native
See Also
SystemColor#controlText
controlDkShadowback to summary
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.

controlHighlightback to summary
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.

controlLtHighlightback to summary
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.

controlShadowback to summary
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.

controlTextback to summary
public static final SystemColor controlText

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

DESKTOPback to summary
public static final int DESKTOP

The array index for the desktop system color.

Annotations
@Native
See Also
SystemColor#desktop
desktopback to summary
public static final SystemColor desktop

The color rendered for the background of the desktop.

INACTIVE_CAPTIONback to summary
public static final int INACTIVE_CAPTION

The array index for the inactiveCaption system color.

Annotations
@Native
See Also
SystemColor#inactiveCaption
INACTIVE_CAPTION_BORDERback to summary
public static final int INACTIVE_CAPTION_BORDER

The array index for the inactiveCaptionBorder system color.

Annotations
@Native
See Also
SystemColor#inactiveCaptionBorder
INACTIVE_CAPTION_TEXTback to summary
public static final int INACTIVE_CAPTION_TEXT

The array index for the inactiveCaptionText system color.

Annotations
@Native
See Also
SystemColor#inactiveCaptionText
inactiveCaptionback to summary
public static final SystemColor inactiveCaption

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

inactiveCaptionBorderback to summary
public static final SystemColor inactiveCaptionBorder

The color rendered for the border around inactive windows.

inactiveCaptionTextback to summary
public static final SystemColor inactiveCaptionText

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

indexback to summary
private transient int index
INFOback to summary
public static final int INFO

The array index for the info system color.

Annotations
@Native
See Also
SystemColor#info
infoback to summary
public static final SystemColor info

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

INFO_TEXTback to summary
public static final int INFO_TEXT

The array index for the infoText system color.

Annotations
@Native
See Also
SystemColor#infoText
infoTextback to summary
public static final SystemColor infoText

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

NUM_COLORSback to summary
public static final int NUM_COLORS

The number of system colors in the array.

Annotations
@Native
SCROLLBARback to summary
public static final int SCROLLBAR

The array index for the scrollbar system color.

Annotations
@Native
See Also
SystemColor#scrollbar
scrollbarback to summary
public static final SystemColor scrollbar

The color rendered for the background of scrollbars.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.Color.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.

Annotations
@Serial
systemColorObjectsback to summary
private static SystemColor[] systemColorObjects
systemColorsback to summary
private static int[] systemColors
TEXTback to summary
public static final int TEXT

The array index for the text system color.

Annotations
@Native
See Also
SystemColor#text
textback to summary
public static final SystemColor text

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

TEXT_HIGHLIGHTback to summary
public static final int TEXT_HIGHLIGHT

The array index for the textHighlight system color.

Annotations
@Native
See Also
SystemColor#textHighlight
TEXT_HIGHLIGHT_TEXTback to summary
public static final int TEXT_HIGHLIGHT_TEXT

The array index for the textHighlightText system color.

Annotations
@Native
See Also
SystemColor#textHighlightText
TEXT_INACTIVE_TEXTback to summary
public static final int TEXT_INACTIVE_TEXT

The array index for the textInactiveText system color.

Annotations
@Native
See Also
SystemColor#textInactiveText
TEXT_TEXTback to summary
public static final int TEXT_TEXT

The array index for the textText system color.

Annotations
@Native
See Also
SystemColor#textText
textHighlightback to summary
public static final SystemColor textHighlight

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

textHighlightTextback to summary
public static final SystemColor textHighlightText

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

textInactiveTextback to summary
public static final SystemColor textInactiveText

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

textTextback to summary
public static final SystemColor textText

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

WINDOWback to summary
public static final int WINDOW

The array index for the window system color.

Annotations
@Native
See Also
SystemColor#window
windowback to summary
public static final SystemColor window

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

WINDOW_BORDERback to summary
public static final int WINDOW_BORDER

The array index for the windowBorder system color.

Annotations
@Native
See Also
SystemColor#windowBorder
WINDOW_TEXTback to summary
public static final int WINDOW_TEXT

The array index for the windowText system color.

Annotations
@Native
See Also
SystemColor#windowText
windowBorderback to summary
public static final SystemColor windowBorder

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

windowTextback to summary
public static final SystemColor windowText

The color rendered for text of interior regions inside windows.

Constructor Detail

SystemColorback to summary
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

readResolveback to summary
private Object readResolve()

The design of the SystemColor class assumes that the SystemColor object instances stored in the static final fields above are the only instances that can be used by developers. This method helps maintain those limits on instantiation by using the index stored in the value field of the serialized form of the object to replace the serialized object with the equivalent static object constant field of SystemColor. See the writeReplace method for more information on the serialized form of these objects.

Returns:Object

one of the SystemColor static object fields that refers to the same system color.

Annotations
@Serial
toStringback to summary
public String toString()

Overrides java.awt.Color.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.

Returns:String

a string representation of this Color

updateSystemColorsback to summary
private static void updateSystemColors()

Called from <init> and toolkit to update the above systemColors cache.

writeReplaceback to summary
private Object writeReplace() throws ObjectStreamException

Returns a specialized version of the SystemColor object for writing to the serialized stream.

Returns:Object

a proxy SystemColor object with its value replaced by the corresponding system color index.

Annotations
@Serial
Exceptions
ObjectStreamException:
if a new object replacing this object could not be created
Serial data
The value field of a serialized SystemColor object contains the array index of the system color instead of the rgb data for the system color. This index is used by the readResolve method to resolve the deserialized objects back to the original static constant versions to ensure unique instances of each SystemColor object.