Section 13.3 Color Control

• Class Color (p. 559) declares methods and constants for manipulating colors in a Java program.

• Every color is created from a red, a green and a blue component. Together these components are called RGB values (p. 560). The RGB components specify the amount of red, green and blue in a color, respectively. The larger the value, the greater the amount of that particular color.

Color methods getRed, getGreen and getBlue (p. 560) return int values from 0 to 255 representing the amount of red, green and blue, respectively.

Graphics method getColor (p. 560) returns a Color object with the current drawing color.

Graphics method setColor (p. 560) sets the current drawing color.

Graphics method fillRect (p. 560) draws ...

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.