Skip to content

Instantly share code, notes, and snippets.

@seanh
Created May 25, 2009 15:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanh/117585 to your computer and use it in GitHub Desktop.
Save seanh/117585 to your computer and use it in GitHub Desktop.
Get a Swing GUI up and running. (Handy for testing swing components.)
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class MyClass {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container contentPane = frame.getContentPane();
contentPane.setLayout( ... );
contentPane.add( ... );
f.pack();
f.setVisible(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment