Urgent: Gif animation shows only the last frame when reloaded

I use ImageIcon to show gif animations on screen. I want to use only non-looping gif animation files.
Always when I show a gif animation for the first time it runs correctly through all the frames.
However when reloading later the same gif animation only the last frame appears. I want to see all the frames of the animation, not only the last frame.
So for the first showing of the animation this works well:
     icon = new ImageIcon("first_animation.gif");
       label = new JLabel();
       label.setIcon(icon);Then I show another animation and also it works well:
       icon2 = new ImageIcon("second_animation.gif");
       label.setIcon(icon2);Now I would like to show the first animation again but only the last frame of that first animation appears on screen:
label.setIcon(icon);And even this alternative way to refresh does not work:
       icon = new ImageIcon("first_animation.gif");
       label.setIcon(icon);
How can I reload the first animation again so that it shows all the frames not only the last frame???
I have tried for ex. commands updateUI(); and setImageObserver but they don't seem to help.
I am only a novice so...
Please I would really appreciate your detailed advice what lines I should rewrite in my code and how?
Thank you very much!!

By flagging your question "urgent", you are implying that either your question is more important than other people's questions, or your time is more valuable than mine (or someone else's answering questions here). Both are not true.

Similar Messages

  • When I send mi presentation to a Quick Movie, the program record only the last frame

    Why when I send mi presentation to a Quick Movie, the program record only the last frame, how I do to record the whole presentation of 52 frames

    I mean when I try to burn a CD.

  • DataLine replay the last frames when I dont write in it

    Hi,
    I have an App who receives bytes[] from UDP Packets, and write in a dataLine. The problem is clear, when I dont receive any packets, dataLine replay the last frames:
    This is the code:
    AudioFormat audioFormat = new AudioFormat(8000, 16, 1, true, false);
    DataLine.Info info = new DataLine.Info(SourceDataLine.class,
                        audioFormat);
    SourceDataLine dataLine = null;
    dataLine = (SourceDataLine) AudioSystem
                             .getLine(info);
    dataLine.open(audioFormat);
    dataLine.start();
    while(true)
    if ( receive Sound )                    
              decode_G729 = gd.G729Decode(soundReceived);
              dataLine.write(decode_G729, 0, decode_G729.length);
    System.out.println(dataLine.getLongFramePosition());                    
    }This is the output of the frames:
    Start receiving sound:
    7680
    7680
    7680
    7440
    7600
    7760
    7840
    8080
    8160
    8160
    8160 Stop receiving sound in this moment:
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    *4320
    4560
    5040
    5280
    5680
    5920
    7120
    7520
    7840
    8160*
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    8160
    You can see that??? In some moment, when Im not writing in the DataLine, the FramePosition get back to an earlier position, and in some cases, replay the last moment of the sounds!!
    Is really annoying, and I dont know how to fix it.
    Any help would be appreciated.

    AntonioMG wrote:
    My intention was to put a code as clear as possible, I think theres no need to be rude...If you're asking for someone to help you find a bug in your code, you don't rip out sections of your code that could contain the bug you're looking for for the sake of clarity. It's a waste of everyone's time, and frankly, makes you look like a troll.
    Giving the impression of wasting my time will result in me being rude to you. Sorry for the misunderstanding...
    That said, try the following code and report back the results...
    AudioFormat audioFormat = new AudioFormat(8000, 16, 1, true, false);
    DataLine.Info info = new DataLine.Info(SourceDataLine.class,
                        audioFormat);
    SourceDataLine dataLine = null;
    dataLine = (SourceDataLine) AudioSystem
                             .getLine(info);
    dataLine.open(audioFormat);
    dataLine.start();
    while(true) {
        socket.receive(packet);
        RTPPacket rtpPacket = new RTPPacket(packet.getData() , packet.getLength());
        if ( rtpPacket.getPayloadType() == 18 && rtpPacket.getPayloadLength() == 20) {
         // Ensure the line is started
         dataLine.start();
            decode_G729 = gd.G729Decode(soundReceived);
            dataLine.write(decode_G729, 0, decode_G729.length);
        // Stop the line if it's inactive
        if (! dataLine.isActive() {
            if (dataLine.isRunning()) {
                dataLine.stop();
        System.out.println(dataLine.getLongFramePosition());                    
    }

  • Why is my podcast now showing only the last 5 episodes?

    My podcast is now only showing the last 5 episodes for some reason. Even when I suvscribe, I can't get past episodes anymore.
    My podcast itunes address is - https://itunes.apple.com/us/podcast/beginner-internet-business/id432758500
    My feed is - http://feeds.feedburner.com/BIBPodcast
    Jonathan

    Here's the iTunes link as well:
    https://itunes.apple.com/us/podcast/animation-fascination/id528946729?mt=2&ign-m pt=uo%3D4

  • How do I limit my email to show only the last 50 as in previous versions?

    I updated my phone and now I do not see how to limit my emails to show the last 50 only as I did in previous versions. Anyone no how to do this and to select all for deleting emails?

    Hi Katbat,
    I think I've *almost* found out how to do this.. sign up for "BC Backups". Sync file with your dropbox. Open the backup file "Orders" and it will show the columns below. Maybe you can cross compare it with the BC report to get your other columns?
    We use it to see discount codes / a report on value of invoices where discount codes were used. It's like business catalyst reports on steroids. Hope that helps
    Id
    Order ID
    Order Name
    Workflow Id
    Status Type Id
    Order Type
    Invoice Number
    Invoice Date
    User Id Assigned To
    Shipping Amount
    Shipping Tax Rate
    Shipping Attention
    Shipping Instructions
    Shipping Option Id
    Discount Code Id
    Discount Rate
    Total Order Amount
    Direct Debit Type Id
    Direct Debit Days
    Is Recur
    Next Invoice Date
    End Recur Date
    Cycle Type Id
    Create Date
    Last Update Date
    Deleted
    Shipping Street
    Shipping Street2
    Shipping Suburb
    Shipping State
    Shipping Postcode
    Shipping Country
    Billing Street
    Billing Street2
    Billing Suburb
    Billing State
    Billing Postcode
    Billing Country
    Street
    Street2
    Suburb
    State
    Postcode
    Country
    Payment Method Type Id
    Payment Description
    Amount
    Payment Status Id
    Transaction Number
    Transaction Auth Code
    Payment Date

  • How to create a formula that shows only the last date of a series of dates

    I have a report that shows a series of dates that 'notes' were created on a particular file. I want the report to only show the date of the last note that was created instead of showing all the dates. Ive tried using 'Maximum ()' which does not work.
    Any suggestions?

    Either order the dates in ascending order and place the date field in the group footer
    -or-
    order the dates on descending order and plade the date field in the group header.
    HTH,
    Jason

  • Iphoto 6 shows only the last imported photos, doesn't include previous pics

    History- when I first got the computer I didn't understand how iPhoto accessed its photos, and deleted some of the content from the iPhoto folder directly - since then every once in a while I get a window that asks me to rebuild my cache - the apple employees at the genius bar told me that if I rebuilt my cache, that the thumbnails wouldn't match, and I could possibly loose photos. So I have not updated the cache in 4 years, and have not had any problems.
    Recently, my computer was slowing down, so I took it to the apple store and had them help me remove everything from the computer and placed onto an external drive, and then wiped the computer by reinstalling the system. Since then I have run iPhoto through my external hd, and did not replace ANYTHING onto the computer - everything is on the external hd. had no problems for a year. After this last upload(about a week ago) to iPhoto I noticed that it caused all previous photos (10,000+) to disappear - the only ones that were in the library were the ones I just uploaded.
    I then returned to the apple store and they used the option "create new library" to find the existing library.. but the computer was not even allowing the library file to be clicked on. So, for some reason the old photos are gone, and it wont allow the existing library to be chosen - yet there are still photos that it is accessing from that same library.
    Now when I open iPhoto, I get a message that says "In this version of iPhoto, the thumbnails have been improved. Upgrading the thumbnails will take a while, depending on the number of photos in your library. Do you want to upgrade your thumbnails now?"
    I am afraid that if I do this, it will cause the same problem of confusing the program, and not having the thumbnails match the iPhoto files, possibly causing me to loose photos.
    Is this message the reason why I can't access the old photos in the library? How would you suggest I go about correcting this problem in a way that I don't loose photos?

    I didn't understand how iPhoto accessed its photos, and deleted some of the content from the iPhoto folder directly
    This corrupted your library - b continuing to use a corrupted library you have continued the problem and it sounds like it finally has come in to bite you
    You can try using iPhoto Library Manager - http://www.fatcatsoftware.com/iplm/ - to rebuild your library - this creates a totally new library so if the results are not acceptable you can go back to what you have
    other than that you have no choice I am aware of except to start over - drag the iPhoto library to the desktop and launch iPhoto and create a new library - open the old corrupt iPhoto library and open the originals folder and drag each folder in it onto iPhoto recreating your rolls but losing all edits and other changes
    LN

  • Aminated gifs only showing the last frame on the 2nd time of viewing

    I have 2 animated gifs and on pressing a button i am changing between the 2 on te first click the animated gif runs sucessfully and clicking the button again the 2nd animated gif runs sucessfully. However when i go to run the first animated gif again it only shows the last frame and this continues no matter how many times you press the button. Is there any way of getting it to start from the first frame. By the way just in case it makes a difference both the animated gifs run once they do not continously keep going and that is how i want them to be.

    public void mousePressed(MouseEvent e){
         if(corner.contains(e.getX(),e.getY())){
         if(reversed){
              setImageFile(gui.getFrontImage());
                   gui.setComponents(true);
                   reversed = false;
         else{
              setImageFile(gui.getBackImage());
                   gui.setComponents(false);
                   reversed = true;
         repaint();
    public void setImageFile(java.lang.String imageFile) {
         fieldImageFile = imageFile;
    /* Get and download the image for the new postcard background */
    backgroundImage = Toolkit.getDefaultToolkit().getImage( fieldImageFile );
         MediaTracker mt = new MediaTracker( this );
         mt.addImage( backgroundImage, 0 );
         try{     
              mt.waitForID( 0 );          
         catch( InterruptedException ie )
         repaint();
         mt.removeImage(backgroundImage, 0);
    public void paint(Graphics g)
    {     if( backgroundImage != null )
         g.drawImage( backgroundImage, 0, 0, this );
    so basically i press an srea area on the screen and every time i do it alternates between these 2 animated gifs gui.getBackImage() just returns te string of the animated gif file. I've checked to make sure that a new instance of the media tracker is being created each time and it is so i'm not really sure where the problem is!!

  • GIF animations load only first frame

    GIF animations show up as still images. Animation only loads after right-clicking and going to image info.

    You have the image.animation_mode set to none as you can see in the System Details List.
    *image.animation_mode: none
    You need on of the other (normal or once)

  • Index an array of images only the last image shows

    Hi everyone,
    I try to index an array of images and all but the last element give me the error: "not an image."
    Here is a picture of the vi. The first for loop loads the images and stores them in an auto indexed tunnel. Every diagnostic I ran on this loop showed everything is fine. The second for loop should display the sequence of image stored in the auto indexed tunnel, but it does not. Instead I have the error message that elements 0 to n-1 are not images, and only the last image is displayed.
    What am I doing wrong?
    Thanks for your help.
    and the vi: 
    Solved!
    Go to Solution.
    Attachments:
    PulsedImageDisp1.vi ‏31 KB

    Speed of what? The second loop can't run until the first loop is done, and all the operations are linear. I'm guessing you're referring to the perceived speed of displaying the images one after the other so you don't have to wait for the next image to be read which is why you pre-load all the images. Otherwise, the overall speed should be the same whether you use one loop or two. Actually, to be technically accurate, the two loop version will likely be a little slower overall since LabVIEW has to allocate more memory to store all the images, while in the one loop version it is only ever dealing with one image. If the images are large then you might actually run into a memory issue with the two-loop version (arrays need contiguous memory). Just something to keep in mind and to be careful about.

  • I have a question about the suggestion that only the last tab loaded shows up so Firefox can load faster.

    My question is this:
    If I do as you suggest in the General Tab of Preferences - see below - how do I get all the other tabs back if only the last one shows? If they are hidden, I need to know how to access them.
    Your directions which I need help with....Don’t load tabs until selected. Voila! Now, only the last tab you were working in will be loaded on startup.
    THANKS.

    The Tabs are all there, the only thing this preference does is tell firefox to only download the open tab. If you click on the other tabs, they will download too. The theory is, by only downloading and displaying one webpage, it can be displayed for you faster than if 5 webpages were being downloaded at once.

  • I select a page for printing and the print page shows only the frame data and this is all that it prints.

    when I click on print the page to print shows only the frame and that is all that is printed. Why isn't the page data shown on the print page and also printed?

    This is how you do it:
    http://i1224.photobucket.com/albums/ee374/Diavonex/c7db8382.jpg
    http://i1224.photobucket.com/albums/ee374/Diavonex/5e4aadae.jpg

  • Only the last photo download shows up in iPhoto

    I just downloaded new photo from my Camera. Those new photos are the only one that now appears into iPhoto. I can still see my 73G iphoto library on my hard drive, I can also see the pictures when I click on show package content, but I am unable to open it with iPhoto. If I double click to open the library, iPhoto opens up and the only photo show are the last few that I downloaded.
    Can anyone help?
    MacBook Pro Mac OS X (10.5.1) iPhoto '08 version 7.1.1

    Try to go to iphoto>file>import to librarY
    No, please don't do that!
    If you do then iPhoto will import Original, Modified and thumbnail files and treat them all as individual new images, leading to a mess and massive duplication.
    To try and get iPhoto to open the library the correct way is to hold down the option (or alt) key while starting iPhoto, then select 'Choose Library' and navigate to the library location.
    Regards
    TD

  • How do I loop back from the first frame to the last frame?

    Hi there,
    I'm currently working on the framework for a product viewer.
    I have:
    a movie clip called 'viewer_mc' which contains the images take from different angles of the product. The actionscript generates a script on the last frame of this that returns it to frame 1.
    a button instance called 'autoplay_btn' which plays through the movie clip from whatever the current frame is, and stops on frame 1.
    a left and right button which serve to move the movie clip frame, to give the appearance that the product is rotating.
    I have succeeded in getting it to:
    have the movie clip play through once, return to frame 1 and stop.
    have the buttons return functions when held down, that move the frame in the movie clip using nextFrame and prevFrame commands. The right button successfully loops round to frame 1 and continues functioning to give the appearance of continual rotation.
    The last problem I am experiencing is getting the left button to act in the corresponding manner, going from the first frame to the last and continuing to function.
    Here is my actionscript so far:
    import flash.events.MouseEvent;
    var lastFrame:Number = viewer_mc.totalFrames;
    var thisFrame:Number = viewer_mc.currentFrame;
    var backFrame:Number = viewer_mc.currentFrame-1;
    1. This is the part that gets it to play through once before returning to the first frame. I think perhaps the problem I am experiencing is because of the 'viewer_mc.addFrameScript(lastFrame-1, toStart)' part i.e. although I'm holding the left button, its returning to this script and therefor getting bounced back immediately to the first frame. However, there is no flicker on the screen which you might expect if this were the case
    Note - as this is a generic product viewer which I can use as a template I am using lastFrame etc. as opposed to typing the value in
    function toStart (){
              viewer_mc.gotoAndStop(1);
    viewer_mc.addFrameScript(lastFrame-1, toStart);
    2. This is the functionality for the autoplay_btn that will play through a rotation / return the viewer to the initial (frontal) view of the product (frame 1).
    autoplay_btn.addEventListener(MouseEvent.MOUSE_DOWN, autoplay);
    function autoplay (ev:MouseEvent):void{
              var startFrame:Number = viewer_mc.currentFrame;
              viewer_mc.gotoAndPlay(startFrame);
    3. This is the functionality of the right button, which when held, moves the movie clip to the next frame via the 'rotateRight' function based on the 'nextFrame' command. It loops back round to the first frame due to the 'viewer_mc.addFrameScript(lastFrame-1, toStart)' script generated on the last frame of the movie clip, as is desired.
    right_btn.addEventListener(MouseEvent.MOUSE_DOWN, rightDown);
    function rightDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stoprightDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateRight); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stoprightDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateRight);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stoprightDown); //remove the listener for mouse up
    function rotateRight(e:Event):void {
        viewer_mc.nextFrame();
    4. This is the functionality of the left button, which when held, moves the movie clip to the prev frame via the 'rotateRight' function based on the 'prevFrame' command. And this is where the problem lies, as although it works for getting the movieclip back to frame 1, it does not loop round to the last frame and continue functioning, as is wanted.
    left_btn.addEventListener(MouseEvent.MOUSE_DOWN, leftDown);
    function leftDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stopleftDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateLeft); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stopleftDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateLeft);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stopleftDown); //remove the listener for mouse up
    I'd imagine it is probably my logic for this part that is really letting me down - I can do a similar function in actionscript 2, but am trying to learn actionscript 3 just to move with the times as it were, and struggling a bit. Still this is only a few days in!
    function rotateLeft(e:Event):void{
              if(thisFrame==1){
                        gotoAndStop(viewer_mc.totalFrames-1);
              } else{
              viewer_mc.prevFrame();
    Any help you can give me would be gratefully received. For an example of the effect I am trying to achieve with the autoplay button etc. I recommend:
    http://www.fender.com/basses/precision-bass/american-standard-precision-bass

    Thanks for getting back to me.
    Here's the code without my comments / explanations:
    import flash.events.MouseEvent;
    import flash.events.Event;
    var lastFrame:Number = viewer_mc.totalFrames;
    var thisFrame:Number = viewer_mc.currentFrame;
    var backFrame:Number = viewer_mc.currentFrame-1;
    function toStart (){
              viewer_mc.gotoAndStop(1);
    viewer_mc.addFrameScript(lastFrame-1, toStart);
    //last image of viewer_mc = first image of viewer_mc
    autoplay_btn.addEventListener(MouseEvent.MOUSE_DOWN, autoplay);
    function autoplay (ev:MouseEvent):void{
              var startFrame:Number = viewer_mc.currentFrame;
              viewer_mc.gotoAndPlay(startFrame);
    right_btn.addEventListener(MouseEvent.MOUSE_DOWN, rightDown);
    function rightDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stoprightDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateRight); //while the mouse is down, run the tick function once every frame as per the project frame rate
    function stoprightDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateRight);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stoprightDown); //remove the listener for mouse up
    function rotateRight(e:Event):void {
        viewer_mc.nextFrame();
    left_btn.addEventListener(MouseEvent.MOUSE_DOWN, leftDown);
    function leftDown(e:Event){
        stage.addEventListener(MouseEvent.MOUSE_UP,stopleftDown); //listen for mouse up on the stage, in case the finger/mouse moved off of the button accidentally when they release.
        addEventListener(Event.ENTER_FRAME,rotateLeft);//while the mouse is down, run the tick function once every frame as per the project frame rate
    function stopleftDown(e:Event):void {
        removeEventListener(Event.ENTER_FRAME,rotateLeft);  //stop running the tick function every frame now that the mouse is up
        stage.removeEventListener(MouseEvent.MOUSE_UP,stopleftDown); //remove the listener for mouse up
    function rotateLeft(e:Event):void{
              viewer_mc.prevFrame();
    The definition of the rotateLeft function is where the problem lies I think - I've taken out my poor attempts at doing the logic from the previous post. If I were to write it out long-hand the statement I want to write is: 'If you get to frame 1 and function rotateLeft is called go to the end of the movie clip'.
    The reason I have to use the viewer_mc.totalFrames-1 definition in the addFrameScript call is the addFrameScript function is 0 based i.e. if you want to call frame 1 of the movieclip you have to return a value of 0 in the addFrameScript (or such is my understanding of it anyway). As such, the last image in the movie clip will need to be the view obtained at 360 degree rotation, which is of course the same view as at 0 degree rotation. As a consequence, the last frame in the movie clip is superfluous for the user, but necessary for the overall effect to be achieved. And, in addition, to keep up the effect of a 360 degree view when the rotateLeft function is called it needs to skip that last frame to go to the lastFrame-1 (or totalframes-1), or in other words, the view of the image prior to completing the full 360 rotation.
    the variables thisFrame and lastFrame are defined at the very top of the script. Like you said they might need to be defined or called on again elsewhere.

  • Why is the green screen visible on the last frame before the next clip?

    Hey guys!
    Maybe I'm ******** but i m having trouble here. I have "key-ed" a bunch of clips and successfully removed the green screen from them. But when placed in the timeline, the green screen of the clip reappears for the single frame before a next clip starts.
    I've re-rendered and chopped ends off but the green screen keeps appearing in the last frame of any keyed clip that is about to cut to a different clip.
    Where am i going wrong?

    Hey! I tried both suggestions but even the self contained quicktime file has the green screen frames popping up.
    I just dont get it, it's infuriating!
    I used "chroma keyer" effect on the clip, only enable "key on saturation", the green screen disappears, I place clip on V2 and image on V1. Image is then visible where the green screen was. All is well until the last frame before a next clip because on that ast frame the green screen appears again. Where am I going wrong? Please help!

Maybe you are looking for