Skip to content

Instantly share code, notes, and snippets.

@ipefixe
Last active March 29, 2017 20:32
Show Gist options
  • Save ipefixe/bc7a4e45207e3c047c9a376d6c8a3bb5 to your computer and use it in GitHub Desktop.
Save ipefixe/bc7a4e45207e3c047c9a376d6c8a3bb5 to your computer and use it in GitHub Desktop.
Show a spin in java
import javax.swing.*;
import java.awt.*;
public class Main extends JFrame {
private JLabel label = new JLabel();
public Main() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(new Dimension(80, 100));
setTitle("Animated gif");
ImageIcon ii = new ImageIcon(this.getClass().getResource("anim.gif"));
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setIcon(ii);
this.getContentPane().add(label);
this.setLocationRelativeTo(null);
this.setVisible(true);
} catch (Exception exception) {
exception.printStackTrace();
}
}
public static void main(String[] args) {
new Main();
}
}
@ipefixe
Copy link
Author

ipefixe commented Apr 13, 2016

anim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment