1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
/* 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
How to navigate from one FRAME to another FRAME by clicking next button. Actually the previous frame hidden backside, not closing. how to get rid of this. please post in this website