
Windows form with some AWT examples
The 'Abstract Window Toolkit' (AWT) is
Java's original platform-independent
windowing,
graphics, and
user-interface widget toolkit. The AWT is now part of the
Java Foundation Classes (JFC) — the standard
API for providing a
graphical user interface (GUI) for a Java program.
When
Sun Microsystems first released Java in
1995, AWT provided only a very thin level of abstraction over the underlying native user interface. For example, creating an AWT
check box would cause AWT directly to call the underlying native subroutine that created a check box. However, a check box on
Microsoft Windows is not exactly the same as a check box on
Mac OS or on the various types of
UNIX. Some application developers prefer this model because it provides a high degree of fidelity to the underlying native windowing toolkit and seamless integration with native applications. In other words, a GUI program written using AWT looks like a native Microsoft Windows application when run on Windows, but the same program looks like a native
Apple Macintosh application when run on a Mac, etc. However, some application developers dislike this model because they prefer their applications to look exactly the same on every platform.
In
J2SE 1.2, the AWT's widgets were largely superseded by those of the
Swing toolkit. In addition to providing a richer set of UI widgets, Swing draws its own widgets (by using
Java 2D to call into low-level subroutines in the local graphics subsystem) instead of relying on the operating system's high-level user interface module. Swing provides the option of using either a native or a cross-platform
"look-and-feel" for the application.
AWT continues to provide the core of the GUI event subsystem and the interface between the native windowing system and the Java application, providing the structural underpinnings on which Swing relies. It also provides several basic
layout managers, a datatransfer package for use with the
Clipboard and
Drag and Drop, the interface to
input devices such as
mice and
keyboards, as well as access to the
system tray on supporting systems.
AWT is the GUI toolkit for a number of
Mobile Java profiles. For example,
Connected Device Configuration profiles require Java runtimes on
mobile telephones to support AWT.
See also
★
Event Dispatch Thread
★
AWT Native Interface (JAWT)
★
Swing
★
Standard Widget Toolkit
External links
★
AWT homepage
★ (AWT
Javadoc API documentation)
★
★