重播非循环gif图像 [英] Replay a non-looping gif image

查看:78
本文介绍了重播非循环gif图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非循环的gif,我用它作为两个JLabel的ImageIcon,但不能同时使用。

I've got a non-looping gif that I use as ImageIcon for two JLabels, but not at the same time.

我的问题是,当我设置第二个JLabel的图标是gif,动画已经播放,所以它只显示它的最后一帧。

My problem is that when I set the second JLabel's icon to be the gif, the animation has already been played, so it only show the last frame of it.

你知道一种获取动画的方法吗?当gif设置为第二个JLabel时?

Do you know a way to get the animation when the gif is set to the second JLabel?

推荐答案

在新创建的图标上尝试使用:

On the newly created icon try using:

icon.getImage().flush();

这篇关于重播非循环gif图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆