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

Similar Messages

  • Animated gif do not work properly on N85

    I bought recently an N85 and downloaded some animated gif pictures and they do not run fluently as they should. The SAME gifs work great on both the E51 and 5700. What is the problem with the new photo viewer in N85?
    Another issue I have with the photo viewer is that I transfered 50 photos to the memory (Sandisk micro SDHC Ultra 8gb class 6) and when I browse the photos its very slow and some pictures are pixely for a long time when viewing them.

    So, it is a general problem in iOS 8.x.x
    Awesome....
    So I got a ridiculous slow ipad 3 with lots of glitches and not working multigestures.
    Is this the the uncomparable user experience which Tim Cook is talking about?

  • Remote not working properly with Apple TV...sporadic fuctioning

    Hello,
    I have no idea what caused this to happen, but both my remotes (I have one from my MacBook Pro and one from my AppleTV) seem to not work properly with AppleTV. It sometimes works but it is extremely frustrating as it only registers about 1 out of every 10-20 clicks then continues to remember the previous clicks therefore making it essentially impossible to select the desired menu/item. Basically it just seems like it's out of control!
    I tested whether it was the remote or AppleTV that was causing the problem by running Front Row on my MacBook Pro and both remotes seem to navigate Front Row perfectly fine. They both act the same way with AppleTV, whether they are paired or not. It seems as though something happened with my AppleTV. This problem occurred randomly, with no specific cause I can think of.
    Please let me know if any of you have ever experienced this problem and what your solution was, if any!
    I have tried restoring to factory conditions, resetting settings, ran diagnostics, unplugged and replugged it, and nothing seems to be working!
    Oh, and I just replaced the battery on one and have tried swapping batteries, etc.
    HELP PLEASE!
    Thank you,
    Travis

    The menus have never been as responsive as they used to since the 2.0 update in my opinion - basically AppleTV seems to cache/buffer remote click if it is busy or perhaps waiting for something to stream from itunes, and when resources become available it suddenly executes all command rapidly which makes it behave wildly in menus.
    Usually happens I find after restarting the unit or if streaming drives have gone in to power saving modes and there's a delay while they wake up to feed the AppleTV.

  • HP computer will not work properly with an HP printer

    I have the following two items that I am trying to use together:
     - HP 23" TouchSmart Desktop, T6500 2.1GHz 4GB DDR3, 500GB HDD (Windows 7)
     - HP OfficeJet 6500 Multi-Function Printer/Scanner/Fax
    When I try to scan to Adobe Acrobat Professional 9.0, the document goes through the scanner, however the dialog box that I would expect (e.g. "Next Page" or "Done") never shows up.  At this point, the system is unresponsive with respect to Adobe or the printer.
    I suspect that it is waiting for the input from the dialog box that never showed up.  I tried to move the other windows to see if the dialog opened in the background, however I am not able to select any of them (they remain frozen).
    I contacted HP Support, only to have them tell me it must be the driver, and I have an "old" printer.  (I did not realize that a 9 month old printer was considered "old").  I have tried all of the possible drivers that are available (original disk, downloads, other downloads from HP tech support), none of these resolves the problem.
    In any case, they were unable to resolve the problem of having an HP computer work properly with an HP printer.  (The printing function seems to work, just very slowly).
    Has anyone else heard of this?  Is there a resolution?

    Update: I am still looking for a solution to this problem - the scanning portion of the Multi-function OfficeJet 6500 does not work properly with the HP TouchSmart computer.
    I have not been able to find anyone in HP that can tell me when (or if) new drivers will be released for this printer.
    I decided to investigate upgrading to a newer version of printer since HP told me the 9 month old printer I have was "obsolete", only to find that the identical printer is still on sale in many stores.  Hmmm....
    I feel like I am getting the run-around from HP.
    I have since tried several more driver/software combinations, but every time I have the same problem (as described in the previous post).
    If anyone has any ideas or suggestions, I would be most happy to hear them.
    Thank you.

  • Help, web cam is not working properly with win vista

    Hii.. my web cam is not working properly with win vista..even if the icon appears bt it does nt start.. its
    lenovo easy capture 2.5...so if u cud suggest me anything...
    Moderator note; subject edited

    re-install drivers and try again. ( also easy capture )

  • Hi, My iPhone 4s does not work properly with the sound.

    Hi, My iPhone 4s does not work properly with the sound. It just ring. Any other app it doesn't make sound unless I have my headset or bluetooth. And it make me choose between "DOCK CONECTOR" or my "APPLE TV". Why? Or any sugestion plz

    Hi M3MB3R,
    Thanks for visiting Apple Support Communities.
    You may find the troubleshooting tips in this article helpful:
    iPhone: Sound muffled or low from the speaker or when speaking into the mic
    http://support.apple.com/kb/TS1631
    Cheers,
    Jeremy

  • My iphone 5 does not work properly with Ford Sync,

    Hi, My iphone 5 does not work properly with Ford Sync, everytime I pair the phone, Ford sync navigation system freezes and does not work !
    Can someone help.

    Hi M3MB3R,
    Thanks for visiting Apple Support Communities.
    You may find the troubleshooting tips in this article helpful:
    iPhone: Sound muffled or low from the speaker or when speaking into the mic
    http://support.apple.com/kb/TS1631
    Cheers,
    Jeremy

  • TS4002 Icloud Mail doet not work properly with PC since a few days!!!

    Icloud Mail doet not work properly with PC since a few days!!!

    If you can't solve your issue and no one in the community can help, contact support to speak with a tech support agent at (800) 631-3811.
    - Peter

  • My garage band will not work properly with new lion upgrade..HELP

    My garage band will not work properly with new lion upgrade..HELP
    I have tried to open old session i have done in garage band and many of the effects and instruments I have used will not show up. The system seems to have a bug.

    If the graphical user interface looks broken, that is quite often a problem of corrupted user preferences - have you tried to remove the preferences file, as described in the FAQ
    http://www.bulletsandbones.com/GB/FAQPages/OddBallProbs.html
    Here is again the short version:
    Quit GarageBand, if it is running.
    Open your User Library in the Finder. It is hidden in MacOS X Lion, so use the Finder's "Go" menu:
    Finder > GO    hold down the "Options" key, until the library appears in the menu, select it.
    In the window that opens, open the folder "Preferences" and remove the file:com.apple.garageband.plist and com.apple.garageband.plist.lockfile
    Then try again to run GarageBand and download the loops.
    The preferences file stores all you user settings that you set using the "Preferences" panel in GarageBand, also the layout of the GarageBand window and the location of your recent projects. You will have to enter these settings again after removing the file.
    Regards
    Léonie

  • Resize() of applet is not working properly in java6.0

    Hi iam new to applets i have given one task,that is to display multiple tiff pages in applet, So i have written one applet which displays multiple pages tiff file, i have kept next and previous buttons in the applet to navigate to different pages and here iam using resize() of applet for refreshing applet up to now all fine this all thing i have done in java5.0, but i got a requirement to do in java6.0, in java6.0 applet is not refeshing in the webpage.
    i found the reason that resize() is not working properly.
    Please can someone help me..........
    Thanks&Regards
    Manmohan A

    Dear Aravindth
      (.*?) means -> Select all contents from where you start and end,
    For Ex. <month>(.*?)</month> then Select for start <month> and end last </month> tag.
    (?) Match zero or one occurrences. Equivalent to {0,1}.
    (*) Match zero or more occurrences. Equivalent to {0,}.
    (+) Match one or more occurrences. Equivalent to {1,}.
    (.) (Dot). Match any character except newline or another Unicode line terminator.
    (.*?) means -> Zero or more times Match any character except newline or another Unicode line terminator + Match zero or more occurrences. Equivalent to {0,}.+Match zero or one occurrences. Equivalent to {0,1}.
    Could you please refere the below cite :
    http://www.javascriptkit.com/jsref/regexp.shtml
    Thanks & Regards
    T.R.Harihara SudhaN

  • Old Netscape console 4.2 not working properly with new Directory Server 5.2

    After successfully installing Messaging Server 5.2 and applying patch 2, the old Netscape Console doesn't work properly, I tried running the script which is given in the link
    http://docs.sun.com/source/816-6734-10/index.html
    which hobbles the server by creating a set of dummy jar files in order for the directory server console not making any changes on the messaging server. At first I got these messages:
    Failed to install a local copy of msgadmin52.jar or one of its supporting files: not a ZIP file (END header not found)
    I got the same message for these 2 files:
    admserv42.jar
    msgadmin52.jar
    After that I made real dummy jar files using a zero-length file I created with touch and I got these messages:
    class com.netscape.management.admser.AdminServer not found
    After that I erased all the files created by the script and I get these messages:
    failed to install a copy of admserv51.jar or one of its supporting files: null
    failed to install a copy of msgadmin.jar or one of its supporting files: msgadmin52.jar not found at http://192.168.10.205:5001/
    and for admserv42.jar I get the same message
    Does anyone have a clue on what to do next??
    thanks in advance
    Eduardo

    The thing is that the netscape console 4.5 won't work properly with messaging server 5.2, and the directory server console is not working properly for the directory server. I already know the limitations about these consoles since it is explained in the doc where the procedure of migrating from a 4.x directory server to 5.1. I

  • RFC adapter in XI 3.0 not working properly with BAPI in R/3 4.6C

    Here is the scenario.
    An XML file is received from our customer. This file contains purchase order information that is used to create a sales order in our SAP 4.6C system. Once the sales order is created an acknowledgement is generated and this is returned back to our customer in an XML format.  This scenario is working perfectly fine in our XI 2.0 system but is not working properly in our XI 3.0 test environment. Our custom function module in R/3 is a wrapper function that uses a standard SAP BAPI to create the sales order. Part of the function module does use the statement
    call function 'BAPI_TRANSACTION_COMMIT'
    The last thing the BAPI does is call another function module that using an RFC destination that will return and order acknowledgement.
    Here is what happens within XI and our SAP system.
    The XML file is received and mapped to our imported RFC. The RFC adapter is called and the information is passed onto SAP where our customer function module executed. The sales order is created within SAP without any problems and the second function module is called which references an RFC destination assigned to our XI 3.0 system. The information is sent back to XI and an appropriate file is created for our customer.  All seems to be working properly except that when the original RFC is sent from XI to SAP,  SAP creates a short dump stating
    "call to messaging system failed: com.sap.aii.af.ra.ms.api.DeliveryException:" Then it is put back into the que where 5 minutes later it executes again and trys to recreate the sales order in SAP. (again, this same function module executing from XI 2.0 works fine)
    I believe I have everything configured properly because the SAP side is being executed and I am successfully passing information back from SAP to XI. However the original function module in SAP is failing with the above error message. It appears that the original function module cannot communicate back with XI. I have had SAP looking at this issue and they have not been successful yet in solving this problem.
    Any ideas.
    Thanks,
    Jim d'Hulst

    Hi,
    I think the problem is with the send back of acknowledgement to XI. Does the DeliveryException state something about the sender agreement? I guess you are using a statement like below:
    CALL FUNCTION 'ZABCD'
    destination <tcp/ip destination>
    exporting
    input = ack.
    In that case, check whether the TCP/IP destination is working fine. Also, to be able to exchange message, the structure of the Function Module ZABCD needs to be identified as the sender in XI Configuration (Integration Directory).
    Also, check your config with the blog mentioned below:
    <a href="/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit">/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit</a>
    Regards,
    Amitabha

  • ITunes not working properly with HP running Vista home premier

    My Ipod touch works fine on my windows XP pro system but does not sync photos and podcasts from my other computer at home: new HP Multimedia system running Vista Home Premier. It goes through all the motions but will only add a few photos from a file and they are partially corrupt. Many times it won't add any selected photos. Same with podcasts, they won't sync to the ipod. Have tried various USB ports.

    well, it is easy. i just wish it to sync in a manner that i do not get frustrated with it. it just does not like to sync when i open up itunes on desktop to update apps when they have updates. i have got to revert to plugging in the phone and ipad for it to sync and update apps. if you read through the whole thing you would have found it out. all i am saying is that itunes 10.6.1 and ios 5.1 have bugs and issues that make it hard for a iphone and ipad user to sync and update apps. itunes is slow to open with windows 7 as well as i did not mention that before but i have mentioned it in my other forum posts.
    summary:
    itunes 10.6.1, is slow to open on windows 7,
    syncing ipad and iphone does not update without plugging them in.
    wifi sync is not working properly or as it should, it doesn't recognize phone and ipad unless plugged in.

  • IPhone 5 not working properly with  USB interface in Honda Accord.

    The iPhone 5 seems not to work properly with the USB interface in my 2012 Honda Accord. It says I have 500  songs when I only have 430, it skips over songs and freezes during play.

    I actually have a different problem. I am unable to play Pandora through my USB connection in my 2012 Honda Accord SE with my iPhone 5. I can't get map directions through my speakers or any sounds at all. Any idea if a fix will be available?

  • Gasbuddy web site not working properly with firefox, but working fine with explorer

    I've noticed when I load the web site gasbuddy.com, it is not working properly. It does load, just not performing like it should. When I try using gasbuddy.com on explorer 9, it works fine. I've already tried working in safe mode and that didn't solve the problem with gasbudy.com. Any suggestions as to how to fix the problem? I did do some prior investigating, and I'm very cautious about removing my cookies. It seems when I do that procedure, I lose too much info on certain web sites----weather.com, weatherunderground, etc. Just not sure how to remove cookies to solve a problem with out causing other problems? Thank you.

    I'm glad we were able to figure it out. Many sites are designed with stretchy columns that work with either full zoom or text-only zoom, but definitely not all of them.

Maybe you are looking for

  • Lumia 520 store

    i am a new owner of lumia 520 , i have problem on store connectivity. when i am download/update/installation of any apps will load error massage is we can't connect to the microsoft at the moment. Please could someone put me out of my misery and tell

  • Retrieve fieldtext with dynamic table.

    Hy everyone , Is it possible to retrieve the long or medium text of a field label in data element using cl_abap_elemdescr or cl_abap_typedescr ? Thank's a lot. !!

  • How to have measurement tools in a 3D pdf in acrobat reader ?

    hello, I have the trial version of acrobat 9 pro extended I work with 3D content in pdf file I try to use measurement tool in adobe reader 9 but is not activated. When I create my pdf 3D file in acrobat 9 pro extanded, I have the measurement tool but

  • Email search bug

    I have discovered what I believe is a recent bug in Mail - I am using version 6.6 under OSx 10.8.5 I have my mail preview displayed in sort by date order. It threads the topics for me very nicely and on the indented threads it shows the name of the S

  • How do I put the swype keyboard back to normal size on my Intuition LG messaging keyboard?

    I was just swyping my txt message as per usual and then all of a sudden the keyboard was about half it's size and has arrows on the sides to move it, the keyboard, around.