[JavaSE] GUI (graphical user interface), javasegui
The objects provided by java for gui are in the java. Awt and javax. Swing packages.
Awt: The Abstract Window Toolkit relies on the platform to call the local method of the system.
Swing: a lightweight tool library fully implemented by java
Eclipse officially encapsulates a set of Swt control packages
Layout mode
Stream layout, border layout, grid layout, card layout, coordinate alignment, and panel layout
Frame
Get the Frame object, new and construct the parameter: String form title
Call the setSize () method of the Frame object to set the size, parameter: int width, int height
Call the setLocation () method of the Frame object to set the position. The parameter is the x coordinate of the int and the y coordinate of the int.
Call the setLayout () method of the Frame object to set the layout. Parameter: Flowayout object
Get the Button object, new and construct the parameter: String text display
Call the add () method of the Frame object to add a control. Parameter: Button Object
Call the setVisible () method of the Frame object. The parameter is true of Boolean.
A form is displayed, which is run by a sub-foreground thread. The main thread has ended.
Import java. awt. button; import java. awt. flowLayout; import java. awt. frame; public class GuiDemo {/*** @ param args */public static void main (String [] args) {Frame frame = new Frame ("I Am a form "); frame. setSize (400,300); frame. setLocation (500,200); frame. setLayout (new FlowLayout (); Button button = new Button ("Button"); frame. add (button); frame. setVisible (true );}}