Host Graphics Now
Colors
John's Home Page

Colors
Colors can be designated in Java by at least two ways;
  1. by using constants predefined in the color class.
  2. by constructing new colors using RGB values.
The colors shown below are defined in the color class.  Both the AWT color class and the IFC color class define 13 colors using common names.  The IFC color class also defines 5 other shades of gray, gray231, gray204, gray153, gray102, and gray51, and 2 shades of almost-gray, gray160 and gray255. 
To create custom colors, construct a new color using the RGB values.  Each has a range of 0 to 255.  Declare a new color
Color darkgreen;
and then call the constructor
darkgreen = new Color (0, 128, 0);
darkgreen         
or do both simultaneously:
darkblue = new Color (0, 0, 128);
darkblue         
Colors named in both AWT and IFC
color.white         color.lightgray         color.gray         color.darkgray        
color.black         color.red         color.yellow         color.green        
color.cyan         color.blue         color.magenta         color.orange        
color.pink        
Colors named in IFC only
color.gray231         color.gray204         color.gray153         color.gray102        
color.gray51         color.gray160         color.gray255        

Cartesian Index
Go To Graphics Now Home Page
©1999, J.H.Young E-Mail Me

1