Basic HTML version of Foils prepared Sept 21 1998

Foil 8 The java.awt.Color Classes

From Java Tutorial 98- 3: Graphics and the Abstract Windowing Toolkit NAVO Tutorial -- Sept 23 1998. by Geoffrey C. Fox, Nancy McCracken

Drawing more simple shapes with new colors
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.
c is generated as a Color in RGB format.
graphicsobject.setColor(c); // sets current color in graphicsobject which is used for all subsequent operations
There are particular Color instances already defined such as
  • Color.white equivalent to Color(255,255,255)
  • Color.black as equivalent to Color(0,0,0)
  • Color.pink as equivalent to Color(255,175,175)
  • also orange, cyan, magenta, yellow, gray, lightGray,
  • darkGray, red, green, blue



© 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 Sat Nov 28 1998