Basic HTML version of Foils prepared
May 19 99
Foil 13 Using Java 2D API
From
Java Media Framework API's Basic Information Track Computational Science Course CPS616 --
Spring Semester 1999
.
by
Byeongseob Ki, Scott Klasky, Nancy McCracken
1
To use Java 2D, implement a paint(...) method and cast the Graphics argument to a Graphics2D object
2
3
4
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.
5
Graphics2D g2d = (Graphics2D) g;
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 Mon Jul 5 1999