Ładowanie animowanego GIF w dziwaczności JLabel

Próbuję załadować animowany GIF w JLabel.

Podczas gdy to działa:

URL urlsd;
try {
    urlsd = new URL("http://pscode.org/media/starzoom-thumb.gif");
    ImageIcon imageIcon = new ImageIcon(urlsd); 
    JLabel progress = new JLabel(imageIcon);    
    progress.setBounds(5, 20, 66, 66);
    contentPane.add(progress);
} catch (MalformedURLException e) {
    e.printStackTrace();
}

Z drugiej strony nie ma tego i nie chcę pobierać GIF z adresu URL, ponieważ mam już GIF. Wynik ładowania pokazuje tylko pierwszą ramkę GIF:

try {   
    ImageIcon imageIcon = new ImageIcon(ImageIO.read(ClassLoader.getSystemResourceAsStream("res/images/progress_indicator.gif")));

    JLabel progress = new JLabel(imageIcon);
    imageIcon.setImageObserver(progress);
    progress.setBounds(5, 20, 66, 66);
    contentPane.add(progress);
} catch (MalformedURLException e) {

    e.printStackTrace();
}

Myślę, że musi być jakiś powód, ale nie mogę go znaleźć.

Dzięki! Alex

questionAnswers(3)

yourAnswerToTheQuestion