Java how do i get my gif to animate
<p>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?</p>

<pre><code>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);
}
}
</code></pre>