Home > 类库下载 > java类库 > Java basic learning summary - Graphical user interface GUI (continuous update)

Java basic learning summary - Graphical user interface GUI (continuous update)

高洛峰
Release: 2016-10-15 15:22:25
Original
1918 people have browsed it

 1. The main JavaGUI development tool - the birth and function of the Swing class library

 A qualified Java Developer must not only master the technology, but also have a certain amount of Java historical background knowledge. So first, let’s briefly introduce the main class library used for JavaGUI development: Swing.

  In the Java 1.0 era, there was the Abstract Window Toolkit, abbreviated as AWT, a basic class library for designing GUI. The working principle of the AWT library is to delegate the task of processing user interface elements to the local GUI toolbox of the target platform (operating system), and the local GUI toolbox is responsible for the creation and action of user interface elements. This way of working has advantages and disadvantages. Let’s talk about the advantages first:

The processing speed may be faster.

Can be adapted to different platforms, "write once, use anywhere".

Disadvantages:

Look and feel depends on the target platform.

Some platforms do not have as rich interface components as Windows or Mac (early days). Therefore, the design work of AWT is limited to the "lowest common denominator".

Different platforms have different bugs.

In 1996, Netscape created another GUI library, IFC, which works by drawing user interface components on a blank window, and the peer only needs to be responsible for creating and drawing the blank window. Sun and Netscape collaborated and perfected this approach, creating a user interface library called Swing. This was the birth of Swing.

But Swing has not completely replaced AWT. So far, Java SE 8 still has two functional class libraries, AWT and Swing:

AWT import java.awt (java is the core package)

Swing import javax.swing (javax package) (Function expansion pack)

The reason why Swing has not completely replaced AWT is that Swing is based on the AWT architecture, and Swing only provides more powerful user interface components. In programs written in Swing, AWT is still needed for event processing. To put it simply, Swing is the user interface class and AWT is the underlying mechanism.

Java basic learning summary - Graphical user interface GUI (continuous update)

 2.Create JFrame frame

 3.Add text component JComponent


in the frame
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template