Last active
March 29, 2017 20:32
-
-
Save ipefixe/bc7a4e45207e3c047c9a376d6c8a3bb5 to your computer and use it in GitHub Desktop.
Show a spin in java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} |
Author
ipefixe
commented
Apr 13, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment