0

I am trying to make a loading screen. I have created a new JFrame to hold it in, however the gif isn't animated. How do I fix this?

public class loadingFrame extends JFrame {

public int FRAME_WIDTH = 500;
public int FRAME_HEIGHT = 500;
private JPanel gifPanel;

public loadingFrame() {
    setSize(FRAME_WIDTH, FRAME_HEIGHT);
    createLoadingScreen();
    addGIF();
}

public void createLoadingScreen() {
    gifPanel = new JPanel();
    add(gifPanel);

}

public void addGIF() {
    ImageIcon imageIcon = new ImageIcon(loadingFrame.this.getClass().getResource("loading.gif"));
    JLabel progress = new JLabel(imageIcon);
    gifPanel.add(progress);
}
}
demongolem
  • 9,474
  • 36
  • 90
  • 105
  • [This](http://stackoverflow.com/a/2935241/7047764) may be of some use to you.. – KyleKW Dec 07 '16 at 17:34
  • 1) For better help sooner, post a [MCVE] or [Short, Self Contained, Correct Example](http://www.sscce.org/). 2) One way to get image(s) for an example is to hot link to images seen in [this Q&A](http://stackoverflow.com/q/19209650/418556). 3) *"a new JFrame"* See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) – Andrew Thompson Dec 07 '16 at 21:00
  • 1
    duplicate of http://stackoverflow.com/questions/2935232/show-animated-gif? – Roberto Attias Dec 07 '16 at 23:41

0 Answers0