Created
February 21, 2012 15:24
-
-
Save mythosil/1877014 to your computer and use it in GitHub Desktop.
Swing sample
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.JButton; | |
import java.awt.event.ActionListener; | |
import java.awt.event.ActionEvent; | |
class SwingTest { | |
public static void main(String args[]) { | |
JFrame window = new JFrame("title"); | |
JButton button = new JButton("button"); | |
button.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent ae) { | |
System.out.println("button clicked"); | |
} | |
}); | |
window.add(button); | |
window.setLocationRelativeTo(null); | |
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
window.setSize(160, 160); | |
window.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment