Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6453582
Votes 0
Synopsis Animation gif too fast
Category java:classes_2d
Reported Against
Release Fixed
State 5-Cause Known, bug
Priority: 4-Low
Related Bugs
Submit Date 27-JUL-2006
Description
FULL PRODUCT VERSION :
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
 customer  Windows 2000 [Version 5.00.2195]

A DESCRIPTION OF THE PROBLEM :
I found one animation gif animates too fast.

  http://prev.tinami.com/c/chinats2.gif

Please run the source code bellow. Same happend on JButton.

I confirmed this bug on JDK1.5.0_07 and JDK1.6beta2.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------

import java.awt.*;
import java.net.*;
import javax.swing.*;

class MeApp
{
	public static void main(String[] args) throws Exception
	{
		final URL url = new URL("http://prev.tinami.com/c/chinats2.gif");

		final JFrame frame = new JFrame();

		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		frame.getContentPane().add(new JLabel(new ImageIcon(url)));

		frame.pack();

		frame.setVisible(true);
	}
}


---------- END SOURCE ----------
Posted Date : 2006-07-27 14:22:35.0
Work Around
N/A
Evaluation
In this case fast gif animation is caused by the zero frame delays.
Please note that tools like Mozilla and IE  use artificial delay
(approximately 100ms per frame) if gif image contains zero frame
delay although GIF specification does not define any special way
to handle zero delays.

Please see discussion related to similar Mozilla bug for more details:
https://bugzilla.mozilla.org/show_bug.cgi?id=232769
Posted Date : 2006-07-27 14:32:44.0
Comments
  
  Include a link with my name & email   

Submitted On 16-JUN-2009
scccc
Workaround: sleep in the JLabel imageUpdate method:

		ImageIcon tempImageIcon = new ImageIcon(Toolkit.getDefaultToolkit().getImage(
				this.getClass().getResource("/move1.gif")));
		JLabel tempImageLabel = new JLabel(tempImageIcon) {
			@Override
			public boolean imageUpdate(Image aImg, int aInfoflags, int aX, int aY, int aW, int aH) {
				// Sleep in the daemon thread for a while
				// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6453582
				try {
					Thread.sleep(50);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				return super.imageUpdate(aImg, aInfoflags, aX, aY, aW, aH);
			}
		};

(This will not block the eventQueue as imageUpdate is called via DaemonThread "Image Animator 0")



PLEASE NOTE: JDK6 is formerly known as Project Mustang