1. In Java, a window with a top-level window that is not contained in another window is called a frame.
2. In the AWT library there is a class called frame that describes the top-level window, the swing version of this class named JFrame, which extends to the frame class.
3.JFrame is one of the very few swing components that are not drawn on the canvas. As a result, its decorated parts are drawn by the user's window system, not by swing.
Instance Code
Test class
Import Java.awt.*;import Javax.swing.jframe;public class Test {public static void main (string[] args) { Eventqueue.invokelater (New Runnable () {public void run () {simpleframe f = new Simpleframe (); F.setdefaultcloseoperation ( Jframe.exit_on_close); f.setvisible (True);}});}}
function Class
Import Javax.swing.jframe;public class Simpleframe extends jframe{private static final int default_width = 300;private STA Tic Final int default_height = 200;public Simpleframe () {setSize (default_width,default_height);}}
Output Results
The 4.Swing class is located in the Javax.swing package, and the package name Javax indicates that this is a Java extension package, not a core package.
5. All swing components must be configured by the event dispatch thread, which transfers the mouse click and key control to the user interface component.
6. Simple construction Framework is not automatically explicit, the frame period is not visible at the beginning. You can always draw the components of the framework at this stage before the explicit.
7. The above program does not exit after the main function main ends because the main thread terminates, and the time-allocation thread keeps the program active until the framework is closed or the System.exit method terminates the program.
My Java Learning notes (20) about the framework overview