|
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
|
|
Comments
|
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
|