go to previous page   go to home page   go to next page

Answer:

This is the upper left pixel of the panel (not including the menu bar or margins of the frame).


drawLine()

line on grid paper

To draw a line using the Graphics object of the panel, use:

gr.drawLine(int x1, int y1, int x2, int y2)

This draws a line from (x1, y1) to (x2, y2) in the drawing area using the current pen color. It doesn't matter in which direction you draw the line. The end and the start of the line could be reversed.


QUESTION 13:

Say that the Graphics object grph has a drawing area of width=200 and height=150. Fill in the blanks to draw a line from the lower left corner to the upper right corner of the area.

grph.drawLine( , , ,  )