I have created an Etch A Sketch sort of program using Java. Now I am wanting to change the colour of the shapes and lines that I draw. I am struggling with how to do this. This is as far as I have got at the moment Any help would be mostly appreciated.
else if (String1.equalsIgnoreCase("red"))
{
set.PenColor(Color.RED);
}
With this code I get the;
set. cannot be resolved AND
the method setColor is undefined
Thanks in advance
If you are using plain awt – Graphics class has a method (setColor) to set the color to be used.
JavaDoc for Graphics.
This graphics object should be used in paint methods then.