Create a JFrame

Source code below will show you how to create a java common window using JFrame class.

**********************************************************************
COMPLETE SOURCE CODE FOR : CreateAJFrame.java
**********************************************************************


import javax.swing.JFrame;

public class CreateAJFrame
{
public static void main(String[]args)
{
//Create a window with title "My first window"
JFrame frame=new JFrame("My first window");

//Set close operation when user click window close button
//Window close button here is button at the top right of the window
//with 'x' sign
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Set size for window.In this case we set 300 pixel width and 300 pixel height
frame.setSize(300,300);

//Make your window visible
frame.setVisible(true);

}
}


**********************************************************************
JUST COMPILE AND EXECUTE IT
**********************************************************************

RELAXING NATURE VIDEO