Color

The Color and ColorSpace classes of the java.awt package can be used to make your applets and applications more colorful. With these classes you can set the current color for use in drawing operations, as well as the background color of an applet and other windows. You also can translate a color from one color-description system into another.

By default, Java uses colors according to a color-description system called sRGB. In this system, a color is described by the amount of red, green, and blue it contains—that's what the R, G, and B stand for. Each of the three components can be represented as an integer between 0 and 255. Black is 0,0,0—the complete absence of any red, green, or blue. White is 255,255,255—the maximum amount of all three. ...

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.