This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 130050

Summary: Animated GIFs are not animated
Product: guibuilder Reporter: Jan Stola <jstola>
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED WONTFIX    
Severity: blocker CC: cheenu
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Jan Stola 2008-03-13 15:33:23 UTC
Try to assign an animated GIF to some label or button. The GIF will not be animated in the design time. It will be 
animated in run-time only.
Comment 1 Jan Stola 2008-03-13 15:39:52 UTC
There are (at least) 2 reasons why the icon is not animated.

The first reason is usage of ImageIO.read() in IconEditor. Usage of this method avoids unneeded caching (see issue 
110609 for a test-case). This method returns icons that are not animated. Compare
    label.setIcon(new ImageIcon(ImageIO.read(new java.net.URL(url))));
with
    label.setIcon(new ImageIcon(new java.net.URL(url)));

The second reason is in the way how are ImageIcons serialized (e.g. cloned from model to view). When an ImageIcon for 
animated GIF is serialized and restored then in becomes static (e.g. not animated). Try

    ImageIcon icon = new ImageIcon(new java.net.URL(url));
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.writeObject(icon);
    oos.close();
    icon = (ImageIcon)new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray())).readObject();
    label.setIcon(icon);

Hence, it is not worth the effort to fix this issue.
Comment 2 Jan Stola 2010-01-21 05:43:55 UTC
*** Bug 179691 has been marked as a duplicate of this bug. ***