Example 12.2: Filled Rectangle

The drawRect method draws an open rectangle, a box if you prefer. If you want to draw a filled rectangle, use the fillRect method. Otherwise the syntax is identical. Program 12.2 draws a filled square in the center of the applet. This requires you to separate the applet width and height from the rectangle width and height.

The source code


Copyright 1996 Elliotte Rusty Harold
elharo@sunsite.unc.edu
This Chapter
Examples
Home