/*
Create Frame Window Example
This java example shows how to create frame window using Java AWT.
*/
import java.awt.Frame;
/*
* To create a stand alone window, class should be extended from
* Frame and not from Applet class.
*/
public class CreateFrameWindowExample extends Frame{
CreateFrameWindowExample(String title){
//call the superclass constructor
super();
//set window title using setTitle method
this.setTitle(title);
/*
* Newly created window will not be displayed until we call
* setVisible(true).
*/
this.setVisible(true);
}
public static void main(String args[]){
CreateFrameWindowExample window =
new CreateFrameWindowExample("Create Window Example");
/*
* In order to close the window, we will have to handle the events
* and call setVisible(false) method.
*
* This Example program does not handle events, so you will have
* to terminate the program (by pressing ctrl+C) in a terminal window
* to close the frame window.
*/
}
}
Example Output

Bookmark/Search this post with:
Post new comment