tags:

views:

87

answers:

3

Why does the setColor of a Graphics object reset when I use the repaint method?

A: 

I am guessing you are overriding paint(Graphics) (or possibly update), and not always setting the colour in there. Component sets the colour (and font) of the Graphics object from its own settings. The Graphics object you receive is unlikely to be the same one from one paint to another.

Tom Hawtin - tackline
+2  A: 
Nettogrof
A: 

It is possible you draw an image. If so: after drawing your image the color sets default back to Color.BLACK

Martijn Courteaux