Created
January 18, 2012 18:59
-
-
Save naokirin/1634930 to your computer and use it in GitHub Desktop.
Swing Hello,World
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.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