This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "GIF Watch "GIF New topic
Author

GIF's and IMAGEICON's...

Pat Ziel
Greenhorn

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
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Moving to Swing.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Andreas Pax Lück
Greenhorn

Joined: Nov 04, 2009
Posts: 18
hi!

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

PAX


"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: http://aspose.com/file-tools
 
subject: GIF's and IMAGEICON's...
 
Similar Threads
Popup Window Position
Colouring a rectangle
MouseEvent
Please help with this program
Is this a good approach?