hi all, when i look at the API doc, i found Graphics has two method: fillRect(), clearRect(). fillRect() use current Color and clearRect() use backgroundColor, i can use setColor() set current Color, how can i set backgroundColor? where is the backgroundColor? thanks
Michael, I found this in the Java 2 specs: public abstract void clearRect(int x, int y, int width, int height) Clears the specified rectangle by filling it with the background color of the current drawing surface. This operation does not use the current paint mode. Beginning with Java 1.1, the background color of offscreen images may be system dependent. Applications should use setColor followed by fillRect to ensure that an offscreen image is cleared to a specific color. Hope this helps. Stephanie
michael huang
Ranch Hand
Joined: Jul 30, 2000
Posts: 63
posted
0
Stephanie, thanks a lot is that means background color depend on system, you can not set? and what is the current paint mode, that means paint()? thanks michael
Hi Michael, There is a setBackground() method for Components. You could use it to set the background color of the object containing the rectangle. Hope that helps.