package swingExamples; import javax.swing.JFrame; // Fram1.java // Shows basic usage of JFrame as a main Window public class Frame1 { private JFrame frame; public Frame1( ) { // create JFrame with title frame = new JFrame( "This is the title"); // set the frame's size and position // paramters are in pixels frame.setSize( 300, 300); frame.setLocation( 200, 200); // close application when window closed frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void launch ( ) { frame.setVisible( true ); } /** * @param args */ public static void main(String[] args) { Frame1 frame1 = new Frame1( ); frame1.launch( ); } }