• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

finding out when an animated gif has completed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an animated gif that plays for about 3 seconds then stops (this is how i want it) after the gif has completed i want to be able to put some java components onto of this picture. The problem I'm having is that the gif sometimes takes longer to load and my components appear to soon. At the moment I am using a seperate thread to display the components and making it sleep for 3 seconds before showing them. As you can see this is not the most effective way. I am using media tracker to load the animated gif and am using java 1.1.8 with awt (can't use swing). As anyone got any other suggestions as to how to wait unitl the gif has completely finished before showing the components.
Thanks
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If this is an animated GIF you made yourself, then it would probably be better to animate it with Java, instead of relying on the GIF animation itself. This would ensure the animation finished before drawing components.

Here's a thread in which a person was having a similiar problem...

-Nate
 
jane stockdill
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply, I actually managed to work out a way. I was using te media traker to make sure the image could be drawm then i was drawing the image using g.drawImage(). I found out that this method returns a boolean so I stuck it in a while loop and when the image has been fully drawn it retuns true to say it has finished so I waited unitl that then made the other components visible :-)
while(!g.drawImage( backgroundImage, 0, 0, this )){
//don't do anything
//simply here so that the components don't reappear until the whole gif has been played
}
gui.setComponents(true);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic