tag:blogger.com,1999:blog-34385728.post4894298323522311613..comments2023-12-13T03:19:11.331-08:00Comments on Michael Spector's Blog: Using animated GIF in CLabelMichaelhttp://www.blogger.com/profile/15105460784540339083noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-34385728.post-91311715722587353212010-09-22T23:11:53.240-07:002010-09-22T23:11:53.240-07:00Good job !
You do all in on class with code like ...Good job !<br /><br />You do all in on class with code like this:<br />class AnimatedLabelFeedback extends ImageCycleFeedbackBase {<br /><br /> private final CLabel label;<br /><br /> private final AnimationEngine animation;<br /><br /> public AnimatedLabelFeedback(final CLabel label, final Image[] images) {<br /> super(label.getShell(), images);<br /><br /> this.label = label;<br /> this.label.addListener(SWT.Dispose, new Listener() {<br /> public void handleEvent(final Event e) {<br /> animation.cancelAnimation();<br /> }<br /> });<br /> animation = new AnimationEngine(this, -1, 100);<br /> animation.schedule();<br /> }<br /><br /> @Override<br /> public void initialize(final AnimationEngine engine) {<br /> background = label.getParent().getBackground();<br /> display = label.getParent().getDisplay();<br /> }<br /><br /> @Override<br /> public void saveStoppedImage() {<br /> stoppedImage = label.getImage();<br /> }<br /><br /> @Override<br /> public void setStoppedImage(final Image image) {<br /> label.setImage(image);<br /> }<br /><br /> @Override<br /> public void showImage(final Image image) {<br /> if (!label.isDisposed()) {<br /> label.setImage(image);<br /> }<br /> }<br />}Bibihttps://www.blogger.com/profile/02360070657325377620noreply@blogger.comtag:blogger.com,1999:blog-34385728.post-78244145458405572342010-01-21T08:15:13.753-08:002010-01-21T08:15:13.753-08:00@marcelstoer, in this case you can use AnimatedTab...@marcelstoer, in this case you can use AnimatedTableItemFeedback by analogy with AnimatedLabelFeedback, which will hold a reference to TableItem instead of CLabel, and update its image using TableItem.setImage() accordingly... just a guess :)Michaelhttps://www.blogger.com/profile/15105460784540339083noreply@blogger.comtag:blogger.com,1999:blog-34385728.post-15950541322617029302010-01-20T15:39:04.033-08:002010-01-20T15:39:04.033-08:00How would you go about an animated GIF in a table ...How would you go about an animated GIF in a table viewer?<br />You can't use a "regular" LabelProvider because it can only return Image and you can't use an OwnerDrawLabelProvider because you can't spawn your own animation in the paint() method...because once paint() completes you loose the GC to draw to.marcelstoerhttps://www.blogger.com/profile/03645955941765870021noreply@blogger.com