How to add transparency to images

I want make graphics transparent. how can i do it.
[57 byte] By [Atiqea] at [2007-11-27 0:40:21]
# 1

Hi,

it is fairly simple. You just have to use the AlphaComposite:

// g is the Graphics object

Graphics2D g2d = (Graphics2D)g;

//0.5 to display at 50% transparency

g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) 0.5));

g2d.drawImage(...);

Cheers.

Vince

blendinga at 2007-7-11 22:53:10 > top of Java-index,Security,Cryptography...
# 2
thanx it worked.
Atiqea at 2007-7-11 22:53:10 > top of Java-index,Security,Cryptography...