java.awt.Color
. Be sure to import it if you want to use other than the default colors. You create new colors using the same RGB triples that you use to set background colors on web pages. However you use decimal numbers instead of the hex values used by the bgcolor
tag. For example medium gray is Color(127, 127, 127)
. Pure white is Color(255, 255, 255)
. Pure red is (255, 0, 0)
and so on. As with any variable you should give your colors descriptive names. For instance
Color medGray = new Color(127, 127, 127);
Color cream = new Color(255, 231, 187);
Color lightGreen = new Color(0, 55, 0);
A few of the most common colors are available by name. These are