12.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. 12.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.
|public void drawLine( int x1, int y1, int x2, int y2 )|
|Draws a line between the point (x1, y1) and the point (x2, y2).|
|public void drawRect( int x, int y, int width, int height )|
|Draws a rectangle of the specified width and height. The top-left corner of the rectangle has the coordinates (x, y). Only the outline of the rectangle ...|