Click here to Skip to main content
15,606,569 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code

 URL url2 = new URL("");
image2 = new ImageIcon(;
image2 = new ImageIcon(image2.getImage().getScaledInstance(150, 297, BufferedImage.SCALE_SMOOTH));
FrontImage = new JLabel(image2);
FrontImage.setBounds(10, 11, 151, 297);

the code code is fine, once I load the image that has a transparent background on the web, and I load it onto the program it goes pink for some reason and i don't know why, I want it to have a transparent background like it had on the web, can some one please help? and explain why its pink and not transparent, and also, can some one help me make it transparent?
TorstenH. 22-Jul-13 9:31am    
"the program" ?

Some grafic programs like photoshop like to present transparent as pink. It's not pink, it just looks like that.
stick to *.GIF or *.PNG to keep the transparency
[no name] 23-Jul-13 6:02am    
but it is a png file, but its loaded though a url

1 solution

Darryl Burke has solved this issue rather neatly;[^]

Hope this helps,
Share this answer
[no name] 23-Jul-13 4:54am    
tats very useful but I don't know how to implement it :(
Fredrik Bornander 23-Jul-13 5:22am    
Just copy his class;
It inherits from ImageIcon so you should be able to just replace your current attempt with using that one instead.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900