Animated gif moving to fast

I am trying to display an animated gif in a JLabel. My problem is that for some reason the animated gif speeds through the frames, instead of moving at the speed it was created at. Any idea what might be causing it.
Below is the code I'm using to display the animated gif.
import java.awt.*;
import javax.swing.*;
import javax.swing.JDialog;
import java.io.*;
public class loadingScreen extends JDialog
     private JLabel loadingLabel;
     ImageIcon loadIcon = new ImageIcon("images/animated_loading.gif");
    This function makes the loadingScreen a dialog box which, when
    opened, limits the user to be only able to use this window until
    they close it.
     public boolean startLoadingScreen()
          Window owner = (Window) getParent();
          Dimension d = getSize();
          Rectangle r = owner.getBounds();
          int x = r.x + r.width/2;
          int y = r.y + r.height/2;
          setBounds(x, y, d.width, d.height);
          getCenter();
          setVisible(true);
          return true;
    This function is called by an outside program. It takes in the owner
    frame information. It takes in a string that will be the title of
    the dialog box.
     public loadingScreen(Frame owner,String title,boolean modality)     
          super(owner, title, modality);          
          displayWindow();
    This function makes the gui for the window
     public void displayWindow()
          setResizable(false);
          Box groupBox = Box.createVerticalBox();
          loadingLabel = new JLabel(loadIcon);
          groupBox.add(loadingLabel);
          Container dialogPane = getContentPane();
          dialogPane.setLayout( new FlowLayout() );
          dialogPane.add(groupBox);
          pack();
     private void getCenter()
          Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
          Rectangle frame = getBounds();
          setLocation((screen.width - frame.width)/2,(screen.height - frame.height)/2);
}

Thanks for the help. Once I editied the gif file everything worked fine. As a side note, I used Gimp to edit the file and when I tried saving it had a funny message. "Delay inserted to prevent evil CPU-sucking anim."
Thanks for the help.
Ricky

Similar Messages

  • Is there a way to keep animated gifs moving when a page loads? At some point it just stops but the next page is still loading

    I am working on creating a website that has this "loading" image gif when I go to another page (php). Yes, ajax is cooler but i'm no expert and seo thing keeps me from using it thus i'd go for something this simple. I already tried and realized it works on chrome but not on firefox, what am I missing? Not even sure if this is the right place to ask

    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.
    See http://forums.mozillazine.org/viewforum.php?f=25

  • How To Display An Animated GIF In FORMS

    Hello;
    I want to display an animated Gif(Moving) in forms ver 6 and donot want to use timers.
    Thanks in advance.
    Shahzad.

    Hellow,
    You May Try using OCXs .. like this: http://www.jcomsoft.com/
    Hope This Helps
    Regards
    Tariq

  • Animated GIF is running to fast

    I have an animated GIF in my Java app, and it seems to be running really fast for some reason. When the GIF is just placed in an HTML page to view it runs at the normal speed.
    Any help?
    Thanks.

    I know the topic is a little bit old, but I am seeing this issue as well. Since no answer was ever posted, I thought I would bring it up again. I have several animated gifs that play normally in a web browser, but when I try to display them in Java, they play extremly fast. I am just adding an ImageIcon, the animated gif, to a JLabel and setting the ImageIcons ImageObserver to the label. This technique worked in 1.3 but appears to be broken in the 1.4 releases. I have 1.4.1_02 installed right now.

  • Animated gif is not moving in the FireFox 3.6.3 ?

    why animated gif is not moving in FireFox 3.6.3 ?
    == This happened ==
    Every time Firefox opened

    Same problem in save mode. An animated gif will not start. No offending plugins or themes are installed.
    But if I right-click on the animation and then on "Grafik-Info anzeigen" (maybe "show grafic info") then as soon as the info window starts the animation, it is also started in the browser!
    And this error does not happen on all machines. My Win7 64bit does it right. My XP 32bit (freshly updated) freezes the animation. Weird world.

  • Animated gif not moving, image.animation_mode already set to Normal

    ''dupe of - https://support.mozilla.org/en-US/questions/932846 - locking''
    With image.animation_mode already set to Normal, animated gif are not moving, it seems only the first frame is downloaded. I tried downloading the image, it also seems that only the first frame is downloaded. Then I disabled all extensions, the problem persists. Then I use a whole new profile, there seems to be no problem.
    The question is, is there another hidden settings in firefox which cause this trouble? I do not want to start a new profile just because of this. (It also happens in Firefox version 13)

    Do you see the animation if you check the image in Tools > Page Info > Media or open the image directly in a tab?
    Some security software (firewall) can block animated images and send a normal image instead, so can try to check the advanced settings for Firefox in the firewall if the problem isn't in Firefox.

  • Animated .gif not moving

    I've been intrigued by the new animated "postcards" or cinemagraphs (for example, see http://fromme-toyou.tumblr.com/tagged/gif). I found a great tutorial about how to do this using Photoshop Extended and the animation panel. I created my own, and then followed the instructions for saving the file:
    1. "Save for Web and Devices"
    2. make sure to save as GIF, looped "forever"
    When I previewed the gif (from the "save for web and devices" dialog box), it worked great.
    But when I save the gif, it doesn't move. It is just one frame of the animation, as a static photo. When I click the file, I get a "Preview" that shows all the frames, but I can't ever get it to move.
    Is there a step I'm missing? Or is there some operating system setting I need to change? I've never created an animated gif before, but I can see other people's animated gifs in my email. (I'm attaching my gif in case you can figure it out from that.)
    OKAY...I looked at the attachment, and it moves (my dog's eyes). This is the only time it has worked. I've tried to email it, post it on Tumblr, open it in my browser, but it never worked. Now, I post it here, and--at least as I look at the attachment--it works here. How can I get it to move when I post it online or try to send it via email?
    I'm running Mac OSX 10.6, Photoshop CS 5.1.
    Thank you!
    Carol

    Some email clients disable animated GIFs.
    Web sites like Tumblr that have image upload functions may further process your file during upload by removing its animated features. You could control this by hosting images on your own web site.
    In general, animated GIF files are not ideal for emails because of their large size. GIF is an inefficient format for photorealistic animation/video.

  • Why are the animated Gifs in Firefox 4 moving so slow and choppy?

    When ever I try and look at an animated gif in firefox 4, well, it's just slow and choppy. I google searched and haven't found and remedies to the situation.

    Try to disable hardware acceleration.
    *Tools > Options > Advanced > General > Browsing: "Use hardware acceleration when available"
    If disabling hardware acceleration works then check if there is an update available for your graphics display driver.

  • Animated GIF not cycling frames in Tomcat

    I have pages that use animated gif files to get across a point.
    In the IDE, they cycle the images as they should
    SunAppserver cycles them properly.
    I only get the first frame in Tomcat (5.5.7)
    Over on the java.net, I saw this on a page concerning JAI:
    GIF
    The decoder supports animated GIF files and GIF files with transparent background. Only the first frame of an animated GIF file may be loaded via JAI; subsequent frames must be obtained via direct use of the ancillary codec classes.
    Um, am I missing something, or is this a Tomcat problem ?

    You just need transparency in your file. Not sure if it has to be pre-multiplied. In graphic converter you need to remove the backgrounds. Haven't used GC in years so can't say how you can be sure it's gone but in Photoshop, Illustrator and After Effects you can choose to have a checkerboard background to tell you when you are seeing 'thru' the image and by how much (the overall opacity or mask of the whole image if that doesn't confuse the issue).
    If you are using PS images they will almost certainly generated with a set of rectangles including a perimeter cropping box and white background and these need to go either before it's bitmapped in a vector base app or the relevant pixels erased after it has been bit mapped in GC. As previously mentioned, if you have a unique bkgd colour, colour selecting/keying are some ways to do this). Much faster for >10 images to generate the plots without the bkgd but this may not be possible, what software is source material coming from?
    I regularly bring in vector based moving art-work into keynote with alpha from Adobe AE, Apple Quartz and rendered .mov files. Some codecs (H.264) don't support a separate alpha channel (RGBA) but PNG (slow to render) and animation and a bunch of others do. Pre-multiplying removes the A channel in the RGBA (by multiplying the R/G/B by the A values) thereby speeding and making compatible with some GPUs/render pipelines.

  • Transparent Animated Gif not possible anymore in Keynote 09?

    I have created an animated GIF (a series of transparent GIFs) with Adobe Image Ready, which was showing and playing OK on keynote 2.0.2. I have tried the same animated GIF on 5.0, and it seems the transparency of GIF is gone, it plays OK though. It would appear silly to lose this feature on later keynotes.
    Any ideas why Keynote 5.0 does show the GIF without the transparency?
    Any ideas are appreciated!
    -AstroGrad

    You just need transparency in your file. Not sure if it has to be pre-multiplied. In graphic converter you need to remove the backgrounds. Haven't used GC in years so can't say how you can be sure it's gone but in Photoshop, Illustrator and After Effects you can choose to have a checkerboard background to tell you when you are seeing 'thru' the image and by how much (the overall opacity or mask of the whole image if that doesn't confuse the issue).
    If you are using PS images they will almost certainly generated with a set of rectangles including a perimeter cropping box and white background and these need to go either before it's bitmapped in a vector base app or the relevant pixels erased after it has been bit mapped in GC. As previously mentioned, if you have a unique bkgd colour, colour selecting/keying are some ways to do this). Much faster for >10 images to generate the plots without the bkgd but this may not be possible, what software is source material coming from?
    I regularly bring in vector based moving art-work into keynote with alpha from Adobe AE, Apple Quartz and rendered .mov files. Some codecs (H.264) don't support a separate alpha channel (RGBA) but PNG (slow to render) and animation and a bunch of others do. Pre-multiplying removes the A channel in the RGBA (by multiplying the R/G/B by the A values) thereby speeding and making compatible with some GPUs/render pipelines.

  • Transparent Animated Gif in Keynote 9

    Hello,
    I have been trying to insert some of my transparent animated gif in Keynote 9 with zero success. I have checked that the background of the file was actually transparent - it is - and I have attempted to use the Alpha tool - not working with gif images. Should I give up completely?
    Previous posts on the subject have not provided any solution so I would immensly appreciate any further suggestion on this!
    Thanks!

    You just need transparency in your file. Not sure if it has to be pre-multiplied. In graphic converter you need to remove the backgrounds. Haven't used GC in years so can't say how you can be sure it's gone but in Photoshop, Illustrator and After Effects you can choose to have a checkerboard background to tell you when you are seeing 'thru' the image and by how much (the overall opacity or mask of the whole image if that doesn't confuse the issue).
    If you are using PS images they will almost certainly generated with a set of rectangles including a perimeter cropping box and white background and these need to go either before it's bitmapped in a vector base app or the relevant pixels erased after it has been bit mapped in GC. As previously mentioned, if you have a unique bkgd colour, colour selecting/keying are some ways to do this). Much faster for >10 images to generate the plots without the bkgd but this may not be possible, what software is source material coming from?
    I regularly bring in vector based moving art-work into keynote with alpha from Adobe AE, Apple Quartz and rendered .mov files. Some codecs (H.264) don't support a separate alpha channel (RGBA) but PNG (slow to render) and animation and a bunch of others do. Pre-multiplying removes the A channel in the RGBA (by multiplying the R/G/B by the A values) thereby speeding and making compatible with some GPUs/render pipelines.

  • How can I make a transparent animated gif?

    I'm using CS2. I have an animated gif that I want to take the black background out of so that the animated part of it is all that remains.
    Here is a link to the image:
    http://img.photobucket.com/albums/v97/tragicmike/random/Tesseract.gif
    I basically want to remove all of the black background from the image so that the animated tesseract is all that remains. I know how to open the gif to expose the layers using ImaegeReady, then edit them in PhotoShop. But when I made the black areas of each layer transparent (by selecting the RGB channel, inverting the selection, and hitting delete), saved a copy, and tried viewing it, it seems to just display all of the transparent layers constantly instead of cycling through them.
    Can someone please help me figure out how to make an animated gif with a transparent background? If I lose some of the black areas of the animated part (since they seem to get deleted when I remove all of the black background) it's no big deal. I just need to know how to do this so that it plays correctly.
    Thank you!!!
    Mike

    >
    <b>"I have to wonder why the black background was included on every frame of the moving shape."</b>
    <br />
    <br />Well, George...the only reason I can think of is because it's an animated GIF, and GIFs only support one layer.
    <br />
    <br />Whatever application it was created in should have been able to render it out with a transparent BG. But I suppose the creator had his/her reasons for going with the black BG.
    <br />
    <br />(Full disclosure: I ran across
    <s>that same</s> a similar animation back in December, and the version I grabbed only had the black showing through the inside of the tesseract. I opened it in ImageReady and
    <b>
    <i>added</i>
    </b> a black BG so the edges didn't look jaggedy.)
    <br />
    <br />
    <a href="http://www.pixentral.com/show.php?picture=1FgHXbj4UpXYtUVrbeah7sbqQXDR40" /></a>
    <img alt="Picture hosted by Pixentral" src="http://www.pixentral.com/hosted/1FgHXbj4UpXYtUVrbeah7sbqQXDR40_thumb.gif" border="0" />

  • Disabled JMenuItem doesn show animated gif

    Hi there
    I would like to have a popup menu with actions that are enabled after they have finished with some background task taking some time. Basically this works fine for the enabling action on a shown popup. However, adding an animated gif as the icon or disabled icon does not show it in disabled state. In enabled state it works perfect. Please have a try with the sample code. You should see the disabled item for 2 secs and the icon is not showing up. After being enabled, it does. Invoking the menu again shows the animated gif in its last state left, but not moving any more.
    I guess, repaints are not done appropriately in disabled state... Any ideas how to solve that would be highly appreciated :-)
    Actually I used the icon at http://mentalized.net/activity-indicators/indicators/pascal_germroth/indicator.white.gif
    Cheers
    Daniel
    public class Main
      public static void main(String[] args)
        final JFrame frame = new JFrame();
        frame.addMouseListener(new MouseAdapter()
          public void mousePressed(final MouseEvent e)
            final JPopupMenu popup = new JPopupMenu();
            popup.add(new JMenuItem("Open..."));
            popup.add(new JMenuItem("Close"));
            final JMenuItem action = new JMenuItem("Long loading until enabled");
            action.setIcon(new ImageIcon("C:/spinner.gif"));
            action.setDisabledIcon(new ImageIcon("C:/spinner.gif"));
            popup.add(action).setEnabled(false);
            popup.show(e.getComponent(), e.getX(), e.getY());
            SwingUtilities.invokeLater(new Runnable()
              public void run()
                try
                  Thread.sleep(2000);
                  action.setEnabled(true);
                catch (InterruptedException e1)
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(300, 200);
        frame.setVisible(true);
    }Edited by: daniel.frey on Apr 22, 2009 7:50 AM

    The problem is that you are causing the EDT to sleep, which means the GUI can't repaint itself. Read the section from the Swing tutorial on Concurrency to understand what is happening.

  • Does animated .gif export support animation of library symbols?

    I'm currently using the 30-day free trial of Adobe Flash Professional CC. I was really pleased to see how easily you could export animations in animated .gif format, seemed to run without a hitch.
    One thing I noticed while using Flash is that instances of symbols placed into a scene don't actually animate when you use the "Play" function -- that is to say, when you press Enter and the playhead starts moving along the timeline from its current position. They remain at the very first frame of their respective animations. In order to show the proper animations of symbols, you have to use the Test function (CTRL - Enter) to actually compile a working .swf of the thing.
    This wasn't much of an issue until I tried to export in .gif format and I got this same issue. Instances of symbols don't animate, they only seem to work in compiled .swf's.
    FileDropper link to the working file I'm using: http://www.filedropper.com/flashbottle
    Result .gif: http://i.imgur.com/PZVXST7.gif
    Since the use of symbols in the Flash workflow seems to be a rather common occurrence it seems unthinkable that Flash wouldn't support their usage with whatever mechanism they use to export animated .gif's. Is there some sort of silly mistake I'm making or checkbox I need to toggle? Or is the functionality simply not there?

    Thank you for your reply!
    I check exported GIFs in various browsers and XnView viewer.
    It's definitely not a preview  issue - i have 32Gb of RAM and Nvidia Quadro 4000 GPU on my system.
    I believe the issue is with transparency, because i'm able to export GIFs with solid background just fine
    GIF export dialogue window has 'Transparency' checkbox, so it looks like it should be possible to export an animated GIF with transparent background, but for some reason i'm getting all frames at the same time
    thank you

  • Resized animated gif ImageIcon not working properly with JButton etc.

    The problem is that when I resize an ImageIcon representing an animated gif and place it on a Jbutton, JToggelButton or JLabel, in some cases the image does not show or does not animate. More precicely, depending on the specific image file, the image shows always, most of the time or sometimes. Images which are susceptible to not showing often do not animate when showing. Moving over or clicking with the mouse on the AbstractButton instance while the frame is supposed to updated causes the image to disappear (even when viewing the non-animating image that sometimes appears). No errors are thrown.
    Here some example code: (compiled with Java 6.0 compliance)
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test
         public static void main(String[] args)
              new Test();
         static final int  IMAGES        = 3;
         JButton[]           buttons       = new JButton[IMAGES];
         JButton             toggleButton  = new JButton("Toggle scaling");
         boolean            doScale       = true;
         public Test()
              JFrame f = new JFrame();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              JPanel p = new JPanel(new GridLayout(1, IMAGES));
              for (int i = 0; i < IMAGES; i++)
                   p.add(this.buttons[i] = new JButton());
              f.add(p, BorderLayout.CENTER);
              f.add(this.toggleButton, BorderLayout.SOUTH);
              this.toggleButton.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e)
                        Test.this.refresh();
              f.setSize(600, 300);
              f.setVisible(true);
              this.refresh();
         public void refresh()
              this.doScale = !this.doScale;
              for (int i = 0; i < IMAGES; i++)
                   ImageIcon image = new ImageIcon(i + ".gif");
                   if (this.doScale)
                        image = new ImageIcon(image.getImage().getScaledInstance(180, 180, Image.SCALE_AREA_AVERAGING));
                   image.setImageObserver(this.buttons);
                   this.buttons[i].setIcon(image);
                   this.buttons[i].setSelectedIcon(image);
                   this.buttons[i].setDisabledIcon(image);
                   this.buttons[i].setDisabledSelectedIcon(image);
                   this.buttons[i].setRolloverIcon(image);
                   this.buttons[i].setRolloverSelectedIcon(image);
                   this.buttons[i].setPressedIcon(image);
    Download the gif images here:
    http://djmadz.com/zombie/0.gif
    http://djmadz.com/zombie/1.gif
    http://djmadz.com/zombie/2.gif
    When you press the "Toggle scaling"button it switches between unresized (properly working) and resized instances of three of my gif images. Notice that the left image almost never appears, the middle image always, and the right image most of the time. The right image seems to (almost) never animate. When you click on the left image (when visble) it disappears only when the backend is updating the animation (between those two frames with a long delay)
    Why are the original ImageIcon and the resized ImageIcon behaving differently? Are they differently organized internally?
    Is there any chance my way of resizing might be wrong?

    It does work, however I refuse to use SCALE_REPLICATE for my application because resizing images is butt ugly, whether scaling up or down. Could there be a clue in the rescaling implementations, which I can override?
    Maybe is there a way that I can check if an image is a multi-frame animation and set the scaling algorithm accordingly?
    Message was edited by:
    Zom-B

Maybe you are looking for

  • How do I get more than one photo on a page?

    When I drag a photo to the timeline, it shows up as the full screen. I would like to have 3 or so photos on the screen with some type. How do I do this? Many thanks

  • IMac takes forever to fully boot -- how to fix? PLS HELP!

    On my iMac, I often have to wait like 30 seconds to like 1.5 minutes between the time I press the power button and when I can start doing stuff. (I remember it used to be like 20 seconds always.) Usually I can't click on anything and the dock doesn't

  • Itunes on XP won't connect to itunes store, ping OK

    This has been going on for a while. I can connect to iTunes on my ipad 2 ok. Cannot connect to the iTunes store or the upgrade server.

  • Holding with one hand in landscape mode?

    When playing games, some games require me to hold it with one hand in landscape mode. My iPad doesn't feel as secure as when I hold it with one hand in portrait mode. Is the iPad designed to be held in landscape mode with just one hand... therefore,

  • Mass Deletes

    I have a cf report that is displayed in table format. I want to add a check box at the front of each row so that if it is checked, that entire row/record will be deleted from the db. If I currentl display 10 rows and want to delete 8 of them, then I