Jframe myframe = new jframe (); // generate a window
Myframe. settitle ("test"); // If the construction parameter called during jframe instantiation is jframe (string), this step can be omitted.
Myframe. setdefaclocloseoperation (jframe. exit_on_close); // set to close the window by default. If not set, closing the window actually hides the window. I haven't figured it out yet: windowsconstants. exit_on_close and jframe. the exit_on_close values are all three of the int type. What is the difference in the specific meaning?
Myframe. setlayout (New gridlayout (3, 3); // you can specify a three-row and three-column grid layout.
Myframe. add (childcomponet); // Add sub-elements such as jlabel and jbutton. this is from Java. AWT. the method integrated by the container. The parameter must be Java. AWT. component instance.
Myframe. setvisible (true); // you can only view the javaw.exe process in the Windows Task Manager.
Myframe. setsize (100,200); // set the width and height in pixels or use myframe. Pack (); to automatically adjust the size of the window to adapt to the internal elements of the window.