In Java 1.1, the java.awt.SystemColor
class is a
subclass of java.awt.Color
which provides color
constants that match native component colors. For example, if you
wanted to make the background color of your applet, the same as the
background color of a window, you might use this init()
method:
public void paint (Graphics g) {
g.setColor(SystemColor.control);
g.fillRect(0, 0, this.getSize().width, this.getSize().height);
}
These are the available system colors:
SystemColor.desktop // Background color of
desktop
SystemColor.activeCaption // Background color for
captions
SystemColor.activeCaptionText // Text color for
captions
SystemColor.activeCaptionBorder // Border color for
caption text
SystemColor.inactiveCaption // Background color for
inactive captions
SystemColor.inactiveCaptionText // Text color for
inactive captions
SystemColor.inactiveCaptionBorder // Border color for
inactive captions
SystemColor.window // Background for windows
SystemColor.windowBorder // Color of window border
frame
SystemColor.windowText // Text color inside
windows
SystemColor.menu // Background for menus
SystemColor.menuText // Text color for menus
SystemColor.text // background color for text
SystemColor.textText // text color for text
SystemColor.textHighlight // background color for
highlighted text
SystemColor.textHighlightText // text color for
highlighted text
SystemColor.control // Background color for
controls
SystemColor.controlText // Text color for
controls
SystemColor.controlLtHighlight // Light highlight color
for controls
SystemColor.controlHighlight // Highlight color for
controls
SystemColor.controlShadow // Shadow color for
controls
SystemColor.controlDkShadow // Dark shadow color for
controls
SystemColor.inactiveControlText // Text color for
inactive controls
SystemColor.scrollbar // Background color for
scrollbars
SystemColor.info // Background color for spot-help
text
SystemColor.infoText // Text color for spot-help
text