13.3 Color Control

Class Color declares methods and constants for manipulating colors in a Java program. The predeclared color constants are summarized in Fig. 13.3, and several color methods and constructors are summarized in Fig. 13.4. Two of the methods in Fig. 13.4 are Graphics methods that are specific to colors.

Image

Fig. 13.3 | Color constants and their RGB values.

Image

Fig. 13.4 | Color methods and color-related Graphics methods.

Every color is created from a red, a green and a blue value. Together these are called RGB values. All three RGB components ...

Get Java™ How To Program (Early Objects), Tenth 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.