title: Displaying Gif animation in java
body: <p>Hello I am writing a GUI application on Java 1.6 with Swing.</p>
  
  <p>I have a pop up screen that should display a gif animation while my Swing gui is loading and also a little bit after.</p>
  
  <p>My pop up screen is a JDialog. Tthe animation should be displayed on a JLabel that was added to the Jdialog the following way:</p>
  
  <pre><code>ImageIcon myImgIcon = getMyImgIcon();
  JLabel imageLbl = new JLabel(myImgIcon);
  add(imageLbl, BorderLayout.CENTER); 
  </code></pre>
  
  <p>Now the thing is that the animation only displays after the gui has been loaded. I believe that while the GUI is loading (which is a heavy operation in my application) the EDT is so busy it can't run the animation.</p>
  
  <p>See <a href="https://stackoverflow.com/questions/7724078/how-do-i-show-a-animated-gif-image-using-a-thread">How do I show a animated GIF image using a thread</a>.</p>
  
  <p>Now the thing is it would be wrong for me to make the GUI load on a different thread (not EDT) so I don't know how to solve the problem.</p>
  
  <p>Does anyone have an idea?</p>