title: Problem with gif with transparent background
body: <p>I have a problem with displaying my gif with a transparent background because when I start this program, my gif shows but all pictures of gif stayed on the canvas. Knows somebody some solution, please?</p>
  
  <p><img src="https://i.stack.imgur.com/1dpmw.gif" alt="enter image description here">      <img src="https://i.stack.imgur.com/tMJLD.png" alt="enter image description here"> </p>
  
  <p>This is my code:</p>
  
  <pre><code>package zkouska3;
  
  import java.awt.Graphics;
  import java.awt.Image;
  import java.awt.image.BufferedImage;
  import java.io.IOException;
  import java.net.URL;
  
  import javax.swing.ImageIcon;
  import javax.swing.JFrame;
  
  public class mainl extends JFrame{
      private Image TestImage;
  
      private BufferedImage bf;
  
      public static void main(String[] args) {
          new mainl();
      }
  
      public mainl() {
          setSize(500, 500);
          imageLoader();
          setVisible(true);
      }
      public void imageLoader() {
          try {
              TestImage = new ImageIcon(this.getClass().getResource("pandulak.gif")).getImage();
          }catch(Exception e) {
  
          }
      }
      @Override
      public void paint(Graphics g){
           g.drawImage(TestImage, 0, 0, 300, 300, this);
  }
  
  }
  </code></pre>