I want to set a gif (without loop, just plays once) as an icon of several JLabels (with setIcon). The problem is: when I set it as an icon of the first JLabel the gif plays in a normal way, but in the second and the others just stay at the last frame…
My question is: how can I make that gif plays as many times as I want, without interfering the past JLabels?
Hope I have made my point.
EDIT:
I’ve tried using repaint() but still can’t make it work.
Load the image as a
byte[]and stamp it out as a separate image for each label.The JRE normally caches image instances if loaded by
URLorFile, but providing abyte[](orByteArrayInputStream) to the loading method prevents caching.