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

Java
 URL url2 = new URL("http://frizfraz.com/skin-view/render.php?user=z3nox");
image2 = new ImageIcon(ImageIO.read(url2));
image2 = new ImageIcon(image2.getImage().getScaledInstance(150, 297, BufferedImage.SCALE_SMOOTH));
FrontImage = new JLabel(image2);
FrontImage.setHorizontalAlignment(SwingConstants.LEFT);
FrontImage.setVerticalAlignment(SwingConstants.TOP);
FrontImage.setBounds(10, 11, 151, 297);
contentPane.add(FrontImage);


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?
Posted
Comments
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; http://tips4java.wordpress.com/2010/08/22/alpha-icons/[^]

Hope this helps,
Fredrik
 
Share this answer
 
Comments
[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; http://www.camick.com/java/source/AlphaImageIcon.java
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)



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