title: Adding a GIF image in Java
body: <p>I want to add a <code>gif</code> loading image that will display on my panel in Java. This is the code. The first image is a <code>png</code> which is display but the second image is a <code>gif</code> which isn't displaying.</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  
  public class Welcome extends JFrame{
  public static void main(String[]args) {
  Welcome welcome = new Welcome();
  welcome.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  welcome.setSize(600, 350);
  welcome.setVisible(true);
  welcome.getContentPane().setBackground(Color.white);
  
  
  }
  private JLabel window1;
  private JLabel window2;
  private ImageIcon logo;
  private ImageIcon Spinner;
  public Welcome() {
      super ("HALTON'S PHARMACY");
      setLayout(new FlowLayout());
      window1 = new JLabel("");
      window1 = new JLabel(logo);
      window2 = new JLabel(Spinner);
      window1.setIcon(new ImageIcon("halton_logo.png"));
      window2.setIcon(new ImageIcon("Spinner.gif"));
      add(window1);
      add(window2);
      validate();
  }
  }
  </code></pre>