title: Displaying a transparent GIF in a JFrame without each frame remaining as it plays? (Beginner)
body: <p>I'm trying to display a GIF with a transparent background in a JFrame. My initial code is simple.</p>
  <pre><code>import java.awt.*;
  import javax.swing.*;
  public class GUIProject 
  {
      public static void main(String [] args)
      {
          JFrame pokemonFrame = new JFrame();
          pokemonFrame.setSize(800, 800);
          ImageIcon imageLabel = new ImageIcon(&quot;/Users/Hannah/eclipse-workspace/Graphics/pokemon images/pikasprite.gif&quot;);
          JLabel label = new JLabel(imageLabel);
          pokemonFrame.setLayout(new FlowLayout());
          pokemonFrame.add(label);
          pokemonFrame.setVisible(true);  
      }
  }
  </code></pre>
  <p>Unfortunately, I'm running into a problem that is the exact same as what <a href="https://stackoverflow.com/questions/26330550/java-gif-animation-not-repainting-correctly?noredirect=1&amp;lq=1">this post</a> entails. Essentially, the past frames of the gif remain on the screen as the gif loops, creating a kind of ghosting effect. I'm using the exact same image as the post I linked uses. I have tried to implement the solution the selected answer gave, but it didn't work for me, probably because it's too advanced for me to understand.</p>
  <p>I'm just a beginner, but I'd really like to fix this issue for a project I'm working on for my class.</p>
  <p>I'd like some help implementing this code or finding another solution to the issue I'm having. (I'm sorry if this question is improper! I've never used Stack Overflow  myself, but I've lurked around before.)</p>