Loading Transparency in Image

I have a JSlider and I want an image to mark the center of the slider. This image has a transparent background:

JSlider j =new JSlider();

staticfinalint BARHEIGHT = 15;

staticfinalint BARYPOS = 15;

public BreakEvenSliderUI(JSlider js)

{

super(js);

j = js;

}

publicvoid paintTrack(Graphics g)

{

g.setColor(new Color(0.5f,0.0f,0.0f,0.3f));

g.fill3DRect(0,BARYPOS,

xPositionForValue(j.getValue()),

BARHEIGHT,true);

g.setColor(new Color(0.0f,0.0f,0.5f,0.3f));

g.fill3DRect(xPositionForValue(j.getValue()),BARYPOS,

j.getWidth() - xPositionForValue(j.getValue()),

BARHEIGHT,true);

File f =new File("images/logo.png");

try

{

BufferedImage image = ImageIO.read(f);

Image beCenter = image;

int xCenterOfTrack = (int)((j.getBounds().getWidth()) / 2);

g.drawImage(beCenter,

xCenterOfTrack - 25,

BARYPOS - 15,

j.getBackground(),

j);

}

catch(IOException ex){}

}

Graphics.drawImage() is painting the transparent part of the image to the background color. However, is there a way to have it paint what is behind the image and not just the background?

[2140 byte] By [javaBeeNewba] at [2007-11-27 0:15:15]
# 1
http://www-128.ibm.com/developerworks/library/j-begjava/index.htmli forgot this one http://java.sun.com/docs/books/tutorial/2d/images/drawimage.htmlhope it will help you !!!!!!!!!Message was edited by: supareno
suparenoa at 2007-7-11 22:01:53 > top of Java-index,Desktop,Core GUI APIs...