Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6886908

JLabel flickers with animated GIF

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • None
    • 6u16
    • client-libs

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_16"
      Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
      Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      JLabel is able to render animated GIFs. While most of the time this is working well, with some GIFs there are problems. One example is, when using a transparent animated GIF that is consisting of a combination of differential frames and full frames, JLabel is incorrectly filling the complete drawing area with the background color when drawing a full frame after a differential frame. This leads to the fact, that JLabel flickers at that moment, while the same GIF file is playing flicker-free in other viewers, like Internet Explorer or Firefox. This is not acceptable. While it is clear that JLabel is no first class player, it is obviously a bug and should get fixed.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Send me your email address and I will send you a ZIP file containing a complete project, consisting of a simple Java source and two identical files. One is flickering, the other is not. The difference between them solely is that the flickering one is using a combination of diff frames and full frames, while the smooth one is always using full frames.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Flickers when a full frame is drawn after a diff frame on a transparent background.
      ACTUAL -
      Flickers when a full frame is drawn after a diff frame in a transparent background.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      There is no error message.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;

      import javax.swing.ImageIcon;
      import javax.swing.JLabel;
      import javax.swing.JOptionPane;
      import javax.swing.JPanel;
      import javax.swing.SwingUtilities;

      public class FlickeringAnimation {
      public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
      JPanel p = new JPanel(new BorderLayout());
      p.add(new JLabel(new ImageIcon("OptimizedAnimated.gif")), BorderLayout.NORTH);
      p.add(new JLabel(new ImageIcon("FullAnimated.gif")), BorderLayout.SOUTH);
      JOptionPane.showMessageDialog(null, p);
      }
      });
      }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Do not use diff frames in your animated GIFs.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Imported:
              Indexed: