rocket mass heater kickstarter
The moose likes Swing / AWT / SWT and the fly likes GIF's and IMAGEICON's... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GIF Watch "GIF New topic

GIF's and IMAGEICON's...

Pat Ziel

Joined: Nov 07, 2009
Posts: 9
Hello everyone. I have this issue:

I set an imageIcon on a JButton component. This imageIcon is an animated .gif I made.

When I run my program, the first time I click the animation is properly executed. Afterwards, when I click on other buttons that are present on my grid they skip to the last frame.

Here's the method that is being called:

Now, I assume the image is loaded once in memory and being animated once it doesn't do it again?

P.S I've made my image so that it repeats once. If I loop it, it works fine. But I don't want it to loop.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19908

Moving to Swing.

How To Ask Questions How To Answer Questions
Andreas Pax Lück

Joined: Nov 04, 2009
Posts: 18

i've got exactly the same complication. but i don't really understand what's meant with swing in this case. does the swing library contain a special resource loader or something else?

my animated gif isn't set on unlimited animation repetition. but i have to show the gif animation more than one time anyhow.

how can i reload the image file again?

best regards


"Wenn man irgendwann mal von allen akzeptiert wird, dann weiß man, dass man irgendwas falsch gemacht hat."
Excerpt by: Mr. Weidner
I agree. Here's the link:
subject: GIF's and IMAGEICON's...