Drawing Lines and Shapes
Figure 23.1 shows a Java application that illustrates the different things you'll be learning to draw during this hour: lines, rectangles, ellipses, and polygons.
Figure 23.1. Displaying a sign using Java2D graphics.
With the exception of lines, all of the shapes you can draw can be filled or unfilled. A filled shape is drawn with the current color completely filling the space taken up by the shape. Unfilled shapes just draw a border with the current color.
Before you create an application to draw this sign, we'll describe each of the drawing methods. The comp2D object will be used as the Graphics2D object throughout this ...