It changes the current drawing color to blue.
![]() |
Think of the Graphics object as being like a sheet of paper,
some colored pens, and some drawing methods.
Use setBackground( Color.something )
to change the color of the paper.
Use setColor( Color.something )
to change to a different color pen.
Several million colors.are possible, but
for now, use the pre-defined
Color.red, Color.green, Color.blue,
and 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.