Color.magenta is the closest to purple.


line on grid paper


To draw a line on the Graphics object, use:

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. As usual, the point (0,0) is the upper left corner of the drawing area.

It doesn't matter in which direction you draw the line. The end and the start of the line could be reversed.


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( , , ,  )