tags:

views:

257

answers:

1

Hello! I'm loading an animated gif into a JButton. Online the gif looks to move at a normal pace. But when I load it in java it looks like the animation is trying to run as quickly as possible! How can I atleast slow it down?

Here is my code:

public Icon getIcon(){
  return new ImageIcon(getClass().getResource("images/working.gif"), "Application is running.");
 }

Any ideas? Thanks guys 'n gals.

+2  A: 

Browsers tend to limit the framerate of GIFs. For example, I've read that Opera and IE will fix framerates slower than Firefox. Here's an example of people seeing this effect.

The problem is likely that the delay in the animation is incorrect in the .gif itself, and viewing it in a browser is only masking the issue.

Will Eddins
yes that was problem. I saved the gif with a new frame rate and it now works correctly. Thank you!
Sandro