O'Reilly logo

Java™ How to Program, Seventh Edition by P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.3. Color Control

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

Figure 12.3. Color constants and their RGB values.
Color constantRGB value
public final static Color RED255, 0, 0
public final static Color GREEN0, 255, 0
public final static Color BLUE0, 0, 255
public final static Color ORANGE255, 200, 0
public final static Color PINK255, 175, 175
public final static Color CYAN0, 255, 255
public final static Color MAGENTA255, 0, 255
public final static Color YELLOW255, 255, 0
public final static ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required