O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

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

The java.awt.Color Class

The java.awt.Color class offers three services:

  1. static convenience methods

  2. instance methods

  3. color constants

The static convenience methods mostly involve constructing a Color from a String. Instance methods provide access to the color's rgb makeup, return darker or brighter shades of a color, perform an equality test, etc. The color constants are final static Colors that are used to represent commonly used colors and are listed below.

Color.black

Color.blue

Color.cyan

Color.darkGray

Color.gray

Color.green

Color.lightGray

Color.magenta

Color.orange

Color.pink

Color.red

Color.white

Color.yellow

Most use of the Color class involves accessing the constants listed above. Colors can be constructed, if need be, by one of seven ...

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