The java.awt.Frame component is a Windows graphics system which has a title bar and borders, behaving like a normal GUI window. How is a subclass of java.awt.Container can contain other components being that its primary purpose. The default alignment components added to a Java.awt.BorderLayout.
When working with Frame objects, the following steps are basically followed to get a window to appear on the screen.
1. Create an object of type Frame.
2. Give the Frame object a size using setSize () method.
3. Make the Frame object appear on the screen by calling setVisible () method.
4. In order to close the window by clicking the close(X) button, you will have to insert the code for window closing event.
Following is a table that lists some of the methods of this class:
Constructs a new instance, invisible and without title.
Constructs a new instance, invisible and entitled given
Releases the resources used by this component
Gets the title of the window.
Determines whether or not the window is sizable.
Adds the specified menu bar of the window.
Specifies whether or not the window is sizable.
Specifies the window title.
public static void main (String args)
Frame frame = new Frame("Frame Java Example");
//set the size of the frame
public void windowClosing(WindowEvent e)