In the initial stage of programming, we have been in the console program, because this reason is that many beginners have no sense of accomplishment, facing the temptation of the beautiful Windows graphics user interface, making many people more willing to learn VB. Today, I will introduce the experience of the graphical user interface to everyone, the way to adopt a program, then explain to everyone through the explanation of the procedure, explain the preparation of the graphical user interface to the hope to give you the learning. Help, of course, mistakes point out, please ask your guidance. At the beginning, I will start with a simple window, first look at a simple program: Import javax.swing. *;
Class firstwin {public static void main (string [] args) {jframe mywin = new jframe (); mywin.show ();}} The compilation completion will generate one of the top left corners of the screen to generate a title bar link area (Window Pane) There is no window, only minimized, maximized, close three buttons on the title bar, but unfortunately, after the closing button, the result is only the form disappearance, does not believe in DOS At the console, you will find that the program does not terminate. Let's explain this original code: First, everyone sees the introduction of the Swing user interface library, Java offers Abstract Windows Toolkits (Abstract Window Toolkit), or AWT, from the 1.0 Edition. The basic AWT library handles the user interface element is to generate a window and a variety of user interface elements with the GUI library that own the operating system. In order to achieve the propaganda slogan of "Write Once, Runeverywhere" proposed by Sun, this method can only provide the intersection of the GUI library of various operating systems, which leads to the use of the AWT library to generate the GUI program to develop other tools. Exquisite and beautiful interface. In order to solve this problem, SUN has established a GUI library called Swing for the basic idea of the GUI class that refers to the IFC created by the web. In this class, it has been used in a very different way. The various user interface elements in Swing are completely Java code, and each system simply generates a blank window, then Java draws a variety of user interface elements in this window. And AWT has a decline in speed, but it provides more and more convenient user interface elements, while better supporting the platform-independent. Then, I created a JFrame object, it was a window that saw the runtime, strictly speaking it called "Frame" in Java. The JFrame class is subclass of the Frame class in the AWT library. Finally, the show () method is called to make the JFrame object you just created. To this turn, this program completes the task of generating a closed frame (which is a window that everyone looks). Due to the relationship between time energy, I will adhere to the principle of each day, continuously introduce the preparation of the graphical user interface. Thank you for your support, and I hope that all the high-end fingers will teach and make recommendations. My email is kwaif@sina.com Welcome everyone to believe in recommendations and discuss various issues.