Hello everyone! I am trying to load a transparent background gif([http://www.aoml.noaa.gov/hrd/tcfaq/graphics/animehurr.gif]) on another image (which is a map). My way is adding two JPanels, each of them will load an image as an ImageIcon, however, the gif will display its transparent background as white. So, I googled the problem, it seems someone has a similar problem([t-681840]). I think the background area is not transparent due to the wrong container under the image, but I have no clue to make it right. I appeciated anyone can post a comment, or give me some advice.
I attach my code as following.
{
jPanel1 = new JPanel();
getContentPane().add(jPanel1);
jPanel1.setBounds(12, 10, 647, 358);
ImageIcon iconMap = new ImageIcon("C:\\1\\com\\lfhsolutions\\trackthis\\images\\Map.JPG");
JLabel label1 = new JLabel();
label1.setIcon(iconMap);
jPanel1.add(label1);
this.getContentPane().add(jPanel1);
setVisible(true);
}
{
jPanel2 = new JPanel();
getContentPane().add(jPanel2);
jPanel2.setBounds(330, 200, 50, 46);
ImageIcon iconHurricane = new ImageIcon("C:\\1\\com\\lfhsolutions\\trackthis\\images\\hurricane1.gif");
JLabel label2 = new JLabel();
label2.setIcon(iconHurricane);
jPanel2.add(label2);
this.getContentPane().add(jPanel2);
setVisible(true);
}