From Java Media Framework API's Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. byByeongseob Ki, Scott Klasky, Nancy McCracken
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.