Skip to content

Instantly share code, notes, and snippets.

@naokirin
Created January 18, 2012 18:59
Show Gist options
  • Save naokirin/1634930 to your computer and use it in GitHub Desktop.
Save naokirin/1634930 to your computer and use it in GitHub Desktop.
Swing Hello,World
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
public class SwingHelloWorld extends JFrame{
public static void main(String[] args){
SwingHelloWorld frame = new SwingHelloWorld("Hello");
frame.setVisible(true);
}
SwingHelloWorld(String title){
setTitle(title);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
JLabel label1 = new JLabel("Hello, World");
panel.add(label1);
getContentPane().add(panel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment