Results 1 to 4 of 4
Thread: Animation with Animated GIF
- 06-07-2007, 05:08 PM #1
Animation with Animated GIF
I need to do an animation, I am using an Image object to load an animated GIF. Is there any way to run all the frames which this GIF contains using the Image Object?. I donęt want to extract each image from the gif and then copy them into a jpg format, and then have to make a loop to animate the set of JPG images... it is possible, only load the GIF, and with some java class, animate the gif?
- 06-07-2007, 05:11 PM #2levent Guest
Animated GIFs are supported by Java. Try following code to test the functionality:
Java Code:import java.awt.*; import java.net.*; import javax.swing.*; public class Anima { public static void main(String[] args) throws MalformedURLException { URL url = new URL("<URL to your Animated GIF>"); Icon icon = new ImageIcon(url); JLabel label = new JLabel(icon); JFrame f = new JFrame("Animation"); f.getContentPane().add(label); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); } }
- 06-04-2011, 02:49 PM #3
Member
- Join Date
- Jun 2011
- Posts
- 1
- Rep Power
- 0
Re:Animation with Animated GIF
I also have this same question. Is it necessary to add the ImageIcon directly to the JFrame? In the program I am writing, the JFrame is loaded in another class and then the class containing the gif is added to that JFrame.
- 06-04-2011, 04:26 PM #4
Similar Threads
-
Animation Delay - Thread problem
By wererabit in forum Advanced JavaReplies: 3Last Post: 04-10-2009, 10:35 PM -
Text Animation
By rossomandop@acm.org in forum AWT / SwingReplies: 4Last Post: 05-30-2008, 03:34 AM -
GridLayout with animation?
By tojas in forum AWT / SwingReplies: 3Last Post: 11-12-2007, 10:16 PM


LinkBack URL
About LinkBacks

Bookmarks