Basic HTML version of Foils prepared 13 October 97

Foil 8 The java.awt.Color Classes

From Java Tutorial, July 1, 1996 CSC499(JSU) CPS406/606 -- Fall Semester 97. by Nancy J. McCracken,Geoffrey C. Fox

Drawing more simple shapes with new colors
1 Color c = new Color (redvalue, greenvalue, bluevalue); red/green/bluevalue can be specified as integers in 0 ... 255 or floating point numbers from 0 to 1.
2 c is generated as a Color in RGB format.
3 graphicsobject.setColor(c); // sets current color in graphicsobject which is used for all subsequent operations
4 There are particular Color instances already defined such as
5 Color.white equivalent to Color(255,255,255)
6 Color.black as equivalent to Color(0,0,0)
7 Color.pink as equivalent to Color(255,175,175)
  • also orange, cyan, magenta, yellow, gray, lightGray,
  • darkGray, red, green, blue

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998