• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to display animated gif within an applet that has panels ???

Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks!
I have written a simple applet that will display an animated gif (a small gif that looks like two eyes that move from side to side).
The eyes.gif file is very small (1kb).
When I add complexity of design, by adding 2 panels using a borderLayout design ... I have to press the button 2 times to get the animated gif image to display AND the image appears to be static instead of animated. The static gif loads fine the first button click.
Here is the code - if you substitute the images with some on your own computer it should work.

thank you!
david eberhardt
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi folks!
after searching around on the web, I found an example applet that has some prety sophisticated graphics going on and studied the code to learn how to do what I asked about.
I am building an applet with several panels and wanted to be able to add some gifs to display in response to user interactions.
Here's the applet I found and studied -
This forum seems pretty quite ... let me know if I can help you with similar problem.
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing components already "know" how to support aGifs, if I recall correctly. You may not need to do anything more special than to draw an aGif in a Swing container. You just need to use JApplet, and JPanels, etc, instead of the older AWT equivalents.
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic