I'm using java 1.5 and want to show an animation before starting my application and close it when my application is loaded. I create something after googleing but animated gif doesn't animate if i use not animated gif it shows up.
Does any body what is the problem and know how to do it?
public class SplashFrameSwing extends JFrame{
JPanel contentPane;
JLabel imageLabel = new JLabel();
public SplashFrameSwing(String url) throws IOException {
try {
ImageIcon ii = new ImageIcon(url);
setBackground(new Color(0, 0, 0, 0));
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
contentPane = (JPanel) getContentPane();
contentPane.setLayout(new BorderLayout());
setUndecorated(true);
setSize(new Dimension(ii.getIconWidth(),ii.getIconHeight()));
imageLabel.setIcon(ii);
contentPane.add(imageLabel, java.awt.BorderLayout.CENTER);
this.setLocationRelativeTo(null);
this.setVisible(true);
} catch (Exception exception) {
exception.printStackTrace();
}
}
public static void main(String... args){
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
// URL url = new URL("http://i34.photobucket.com/albums/d129/nirendaran/Speed/verify_anim.gif");
String url = "C:\\Users\\TV\\Pictures\\Icon\\sniffer-prev.gif";
SplashFrameSwing splash = new SplashFrameSwing(url);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}