1.GUI (graphical user interface)
Graphical user Interface (GUI).
Graphically, to show the interface of computer operation, which is more convenient and more intuitive.
2.CLI
Command line user Interface (Shell interface)
is a common DOS command-line operation.
Need to remember some common commands, the operation is not intuitive.
Example:
For example: Create a folder, or delete a folder, etc.
Java provides the GUI with objects that exist in java.awt and javax.swing two packages.
3.AWT and Swing
Java. Awt:abstract window ToolKit (abstract Windows Toolkit), you need to invoke the Local System method implementation functionality. is a weight-level control.
Javax. Swing: On the basis of AWT, a set of graphical interface systems, which provide more components and are fully implemented by Java. Enhanced portability, a lightweight control.
4. Individual components
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/639084/201507/121537332998303.png "style=" border:0 px; "/>
5. Layout Manager
The way the components in the container are discharged is the layout.
Common layout managers:
FlowLayout (Streaming layout manager)
Ordered from left to right.
Panel default layout manager.
BorderLayout (Boundary layout manager)
East, south, west, north, middle
The default layout manager for frame.
GridLayout (Grid layout manager)
Matrix of rules
CardLayout (Card layout manager)
Options tab
GridBagLayout (Grid package layout manager)
Non-rule matrices
6. Create a simple form
Container common subclasses: Window panel, which cannot exist alone. )
Window Common subclass: Frame Dialog
Simple Form creation Process:
Frame f = new frame ("my Window");
F.setlayout (New FlowLayout ());
F.setsize (500,400);//Set Form size
F.setlocation (300,200);//Set the form to appear in the screen location
F.setvisible (TRUE);
7. Event Monitoring Mechanism composition
Event Source (component)
Events (Event)
Listener (Listener)
Event handling (raising post-event processing mode)
8. Event Monitoring Mechanism flowchart
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/639084/201507/121542250806329.png "style=" border:0 px; "/>
9. Event Monitoring Mechanism
Determine the event source (container or component)
The listener is registered to the event source through the Addxxxlistener () method of the event source object.
The method receives the subclass object of the Xxxlistener, or the subclass object of the Xxxlistener subclass Xxxadapter.
It is generally represented by an anonymous inner class.
When overriding a method, the parameter of the method is generally the xxxevent type of the variable to receive.
The event is triggered and the event is packaged as an object to be passed to the variable. (which includes the event source object.) obtained by GetSource () or, getcomponent (). )
10. Menu Inheritance System
650) this.width=650; "src=" Http://images0.cnblogs.com/blog2015/639084/201507/121544188617001.png "style=" border:0 px; "/>
11. Menu
Menubar,menu,menuitem
Create a menu bar, create a menu, and set up menu items in each menu.
The menu can also be added to the menu as a submenu.
Add a menu to the frame by using the Setmenubar () method.
Java-gui "Seven"