More on Drawing and Filling Shapes
The Graphics class provides methods for rendering the following:
Lines
PolyLines
Rectangles
Arcs
Ovals
Polygons
Text
Images
Rectangles, arcs, ovals, and polygons can also be filled. In this section, we will explore all but the last item listed above—for information on displaying and filtering images, the Loading and Displaying Images chapter and the Image Filtering chapter.
Drawing Lines
Lines are drawn by use of invoking Graphics.drawLine(int x, int y, int x2, int y2). The AWT is not capable of drawing lines of variable thickness; the graphics's pen, and therefore the lines it draws, are always one pixel thick. In addition, lines are always drawn solid—there is no provision for patterned lines such as dotted or dashed. ...
Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.