Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Animated GIF's in an Application

Posted on 1998-07-14
4
Medium Priority
?
188 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 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:
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

610 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