[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Animated GIF's in an Application

Posted on 1998-07-14
4
Medium Priority
?
189 Views
Last Modified: 2010-04-16
I would like to know if there is a way, in the standard JDK, to setup and display an animated gif on a Canvas in an application.   I do not want the frame portion's, so I understand that using a Canvas may be a solution.  Also, this is not going to be run as an applet, but a stand alone application.

Thanks

Doug
0
Comment
Question by:lained
  • 2
4 Comments
 
LVL 4

Expert Comment

by:evijay
ID: 1226310
You can do it using JFC Swing component

0
 

Author Comment

by:lained
ID: 1226311
Can it be done without swing?
0
 

Accepted Solution

by:
sulam earned 200 total points
ID: 1226312
You haven't specified which version of Java you're talking about here. The base 1.0 JDK does not support animated GIFs. Swing of course will ship with 1.2, but this probably won't help you. However, if you created the animation yourself, and still have the source images, you can use Animator.java (shipped with the JDK) to play the animation yourself.

If you want to do this without Swing you need to create a DataInputStream attached to the URL which is your animated GIF. You can pull the bytes off and parse them yourself, then use MemoryImageSource to display them. Needless to say this is a lot of work, and it'd be a lot easier to simply use Swing, but it does increase the size of your applet's download.
0
 

Author Comment

by:lained
ID: 1226313
The version is 1.1.6.

Thanks

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question