Home > Java > Javagetting Started > body text

what is awt

藏色散人
Release: 2020-02-07 10:34:40
Original
6112 people have browsed it

what is awt

AWT (Abstract Window Toolkit), translated into Chinese as Abstract Window Toolkit, provides a set of interfaces for interacting with the local graphical interface and is provided by Java to create and Basic tools for setting up Java graphical user interfaces. There is a one-to-one correspondence between the graphics functions in AWT and the graphics functions provided by the operating system, called peers. When using AWT to write a graphical user interface, you are actually using the graphics library provided by the local operating system.

Recommended video tutorial: java video tutorial

Since the styles and functions provided by the graphics libraries of different operating systems are different, the functions that exist on one platform On another platform it may not exist. In order to realize the concept of "write once, run anywhere" claimed by the Java language, AWT has to achieve platform independence by sacrificing functionality, that is, the graphics functions provided by AWT are unique to various operating systems. Provides an intersection of graphics capabilities.

Explanation of terms

Abstract Windowing Toolkit (AWT) is a platform-independent window system for Java,

Graphics and user Interface device toolkit. AWT is part of the Java Foundation Classes (JFC) and provides a standard API for graphical user interfaces (GUI) for Java programs.

AWT provides basic components (components) in the user graphical interface GUI available in JavaApplet and Java Application. Since Java is a platform-independent programming language, but GUI is often dependent on a specific platform, Java uses corresponding technologies to enable AWT to provide applications with an interface that is independent of the machine platform, which ensures that the same program can The GUI has a similar appearance (not necessarily exactly the same) when running on different machines.

There is a big difference between the AWT of Java 1.0 (old AWT) and the AWT after Java 1.1 (new AWT). The new AWT overcomes many shortcomings of the old AWT and has great improvements in design. , and it is more convenient to use. Here we mainly introduce the new AWT, but the old AWT programs can also be run in Java 1.1 and later versions.

Abstract Window Toolkit (AWT) is a graphics process library that uses the Java language to manipulate windows through bitmap displays. Finally, the designer expanded AWT into Alternative Window toolbox and Applet Widget toolbox. The latest GUI interface is called Swing, which extends AWT. Program developers can use Swing to generate platform-independent GUI objects.

Difference

Abstract Window Toolkit AWT (AbstractWindow Toolkit) is a tool set provided by API for Java programs to create a graphical user interface GUI (Graphics User Interface). AWT can be used In Java applets and applications. Its features that support graphical user interface programming include: user interface components; an event handling model; graphics and imaging tools, including shape, color, and font classes; and a layout manager that allows for flexible window layout that is consistent with specific window sizes and screen resolutions. Rate-independent; data transfer class that can be cut and pasted via the native platform's clipboard.

Advantages

When Java was released, AWT received a lot of criticism as the weakest component of Java. The fundamental disadvantage is that AWT provides only a very thin abstraction layer on top of the native user interface. For example, generating an AWT checkbox will cause AWT to directly call the underlying native routine to generate a checkbox. Unfortunately, a checkbox on Windows is not the same as a checkbox on MacOS or various UNIX-style platforms.

This poor design choice makes life uncomfortable for programmers who embrace Java's "write once, run anywhere" creed, because AWT does not guarantee that their applications will How similar it appears on various platforms. An AWT application may perform well on Windows but be almost unusable on Macintosh, or vice versa. In the 1990s, there was a running joke among programmers: the true creed of Java is "write once, test everywhere." One possible reason for this bad situation is said to be that AWT took only one month from concept to implementation.

In the second version of the Java Development Kit, AWT components were largely replaced by the Swing toolkit. Swing avoids the drawbacks of AWT by drawing the device itself: Swing calls low-level routines in the local graphics subsystem instead of relying on the operating system's high-level user interface modules.

The above is the detailed content of what is awt. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
awt
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