Basic HTML version of Foils prepared April 7 1998

Foil 8 Using Java 2D API

From Overview of Java2D and Java3D Frameworks CPS616 Web Technologies -- Spring 98. by Geoffrey C. Fox


To use Java 2D, implement a paint(...) method and cast the Graphics argument to a Graphics2D object
The following example demonstrates how you could use the Java 2D API to draw a red rectangle
  • The basic process for drawing the rectangle with Java 2D API is the same as with java.awt, except the usage of GeneralPath to define rectangle.
Graphics2D g2d = (Graphics2D) g;



© 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 Sun May 3 1998