本文介绍了java - 使imageicon具有透明背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
this is my code
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?
推荐答案
这篇关于java - 使imageicon具有透明背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!