13.5 Drawing Lines, Rectangles and Ovals

This section presents Graphics methods for drawing lines, rectangles and ovals. The methods and their parameters are summarized in Fig. 13.17. For each drawing method that requires a width and height parameter, the width and height must be nonnegative values. Otherwise, the shape will not display.


Fig. 13.17 | Graphics methods that draw lines, rectangles and ovals.

The application of Figs. 13.1813.19 demonstrates drawing a variety of lines, rectangles, three-dimensional rectangles, rounded rectangles ...

Get Java™ How To Program (Early Objects), Tenth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.