Is it possible to make a transparent double buffer? The fillRect,
clearRect and setPaintMode methods in java.awt.Graphics don't
seem to do what they say (filling or clearing a rectangle with
a transparent color does not seem to have any effect).
I am writing a board game and would like to keep the background
image and the pieces on the board on separate layers so that I
don't have to redraw everything when one piece on the board
changes state.

Signature
Antti S. Brax - asb(at)iki.fi Rullalautailu pitää lapset poissa ladulta
http://www.iki.fi/asb/ http://www.cs.helsinki.fi/u/abrax/hlb/
Skippy - 07 Sep 2003 20:29 GMT
> Is it possible to make a transparent double buffer? The fillRect,
> clearRect and setPaintMode methods in java.awt.Graphics don't
[quoted text clipped - 5 lines]
> don't have to redraw everything when one piece on the board
> changes state.
I did this once by setting the pixels of a MemoryImageSource to 0x00FFFFFF
and created an Image from it. This problem is solved in java 1.5 where you
can have transparance when creating BufferedImages. Although the 1.4 javadoc
says it's already possible, I couldn't get it to work...
Good luck!