Although Java is not currently the backbone of front-end development, but as part of the basics of java, it is necessary to learn Java GUI programming, and can make some small and interesting graphics programs to improve learning Enthusiasm. This study summary is a beginner notes and experience, if there is no description or errors, please correct Me.
1. Javagui main development tools--the birth and function of swing class library
A qualified Java Developer, not only to master the technology, but also to have a certain knowledge of the Java historical background Reserves. So let's start with a brief introduction to the main class library for Javagui development: Swing.
In the Java 1.0 era there is a basic class library of design gui, abstract Window Toolkit, abbreviated as AWT. The AWT library works by delegating the task of handling user interface elements to the local GUI toolbox of the target platform (operating system), which is responsible for the creation and movement of user interface elements by the local GUI Toolkit. This kind of working method is advantageous and has the disadvantage , the first point is:
- The processing speed may be a little faster.
- Can adapt to different platforms, "write once, use everywhere."
Disadvantages:
- The perception depends on the target platform.
- Some platforms do not have a rich interface component (early) like Windows or Mac. So the design work of AWT is limited to the "lowest common denominator".
- There are different bugs on different platforms.
In 1996,Netscape created another GUI library ifc, which works by drawing user interface components to a blank window, while the peer is only responsible for creating and drawing blank Windows . Sun and Netscape collaborated and perfected this approach by creating a user interface library called swing, which was the birth of Swing.
But swing does not completely replace awt, and there are still two functional libraries for AWT and swing in Java SE 8:
- AWT Import java.awt (java as core Pack)
- Swing Import javax.swing (javax package as feature expansion Pack)
The reason swing does not completely replace AWT is that swing is based on the AWT architecture, and swing simply provides a more powerful user interface Component. In a program written by swing, AWT is still required for event handling . Simply put,Swing is the user interface class, and AWT is the underlying mechanism .
Inheritance hierarchies for frameworks and component classes in AWT and swing
2. Creating the JFrame Framework
3. Add a text component to the frame jcomponent
Java Basic Learning summary-graphical user interface GUI (hold more)