A good answer might be:

It changes the current drawing color to blue.

Pen Color

Think of the Graphics object as being like a sheet of paper, some colored pens, and some drawing methods. Use the following to change the color of the paper:

setBackground( Color.something )

Use the following to change to a different color pen:

gr.setColor( Color.something )

Several million colors are possible, but for now, use the pre-defined colors:

Color.red, Color.green, Color.blue,  Color.white

These are static values from the class Color. (Look at your local documentation under Color to find more choices.)

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.


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

grph.drawLine( _______, _______, _______, _______ )