ImageIcon v = new ImageIcon(getClass().getResource("/Sample1/Image1.gif"));
v.getImage().flush();
jLabel1.setIcon(v);
JLabel2.setText("Sample");
How to finish the animation first before changing the text of jLabel2?
ImageIcon v = new ImageIcon(getClass().getResource("/Sample1/Image1.gif"));
v.getImage().flush();
jLabel1.setIcon(v);
JLabel2.setText("Sample");
How to finish the animation first before changing the text of jLabel2?
Assuming that Image1.gif
is an animated GIF, I see two approaches:
Extract the images from the GIF, as shown here, and display them in a single sequence.
Play the GIF for a fixed period, then set the label's icon to one constructed from a BufferedImage
copy of the GIF, as shown here.
In either case use javax.Swing.Timer
as required for timing