Multithreaded programming
There are two types of multitask processing
Process-based features: Allows the computer to run two or more programs at the same time
Threads are the smallest processing unit in a thread-based multi-task processing environment
Process refers to a "self-containment" of the running program, with its own address space
Less overhead required for thread-based
In multitasking, individual processes need to allocate their own separate address space
Multiple threads can share the same address space and share the same process together
How to create a thread: 1. Write a class that inherits the thread class, and then override the run () method of the thread class in the class
2. Write a class to implement the Runnable interface, and then associate an instance of the class with the Java.lang.Thread object
Priority: Minimum 1 up to 10 default 5
Java Graphical interface programming
Peers is a local GUI component that is manipulated by AWT peers is invisible to program developers
Weight component: AWT: Coarse, unsightly
Platform inconsistency, "one-time programming, debugging Everywhere"
A program that is less efficient and unsuitable for complex interfaces
Development speed is relatively fast
Lightweight components: Swing: A richer, more convenient collection of user interface elements
Less reliance on the underlying platform and fewer bugs on the platform
A consistent feeling for users on different platforms
Swing components are mostly lightweight components with no peer components
Swing does not replace AWT completely
Component three elements: 1. Content 2. Appearance display 3. Behavior
Swing uses MVC (model-view-control) Design Patterns
The basic idea of MVC divides a GVI component into three parts:
Model section-Store content
View section-Show content
Control section-handling user events
Boderlayout: Divided into 5 districts,
Javaoo 14 16 Chapters