If you cherish your feathers too much, and don't make it a bit of damage, then you will lose two wings and never be able to fly again. --Shelley
The content of this lecture: graphical user interface (graphical users Interface, referred to as GUI)
From the picture above we can see that swing is an upgrade of AWT (different image sizes in Windows and Linux) that Java.swing.JFrame inherits Java.awt.Frame
JFrame is a subclass of a frame, belonging to a container class component, a top-level container (that is, a form), and a class that can be placed on other swing components.
Let's look at a GUI instance
<span style= "FONT-SIZE:18PX;" >import java.awt.*;import javax.swing.*;//x Extension meaning public class Text {public static void main (string[] args) {JFrame F=ne W JFrame ("My first GUI");//Create a frame instance and set the title//f.settitle ("My GUI"), set the window caption f.setlocation (300, 300);//Set the window display position, Unit is pixel f.setsize (400,300);//Set window size in pixels f.setresizable (false),//Set window size cannot change, default is truef.setvisible (true);//Display window, The default is Falsef.setdefaultcloseoperation (jframe.exit_on_close);//set to ensure that the JVM exits when the window is closed (very important)}}</span>
Object-oriented notation
<span style= "FONT-SIZE:18PX;" >import Java.awt.*;import javax.swing.*;//x The meaning of the extension public class Text extends jframe{//put the required swing components, defined here public static void Main (string[] args) {text t=new text ();} Public Text () {this.settitle ("My first GUI"); This.setlocation (+); this.setsize (400,300); This.setresizable ( FALSE); This.setvisible (true); This.setdefaultcloseoperation (Jframe.exit_on_close);}} </span>
This is where we go, take your time and enjoy it
Study Note 20: GUI (i)