Java Reference
In-Depth Information
When Java was first released in 1995, it contained a GUI API referred to as
the Abstract Windowing Toolkit (AWT). This API contained classes like Frame
to represent a typical window, Button to represent buttons, Menu to represent
a window's menu, and so on. The classes and interfaces of the AWT are in the
java.awt packages.
Although it is a useful and important API, the AWT had its shortcomings,
including a lack of support for many popular GUI components. It's not that
the AWT is not useful, but it was a lot of work for those initial Java GUI pro-
grammers to create the look and feel that they wanted their GUI programs to
have.
AWT components are referred to as heavyweight components because
their implementation relies heavily on the underlying operating system.
The look and feel of AWT components depend on the platform the
program is running on. For example, an AWT button will look like a
Windows button when the program is run on a Windows platform. The
same button will look like a Macintosh button when the program is run
on a Macintosh platform.
Aware of the need for a more robust API for creating GUI applications, Sun
Microsystems teamed together with Netscape (and other industry partners)
and created Swing. Swing is actually a part of the Java Foundation Classes
(JFC), a collection of technologies that includes Swing, AWT, Java 2D, Java
Drag and Drop, the Accessibility APIs, and others. The classes and interfaces
of Swing are found in the javax.swing packages.
Swing is different from AWT in that Swing components are 100 percent Java,
thereby not relying on the native operating system or platform. This allows
Swing components to have a pluggable look and feel , meaning that you can
decide what you want your GUI components to look like. For example, if you
want a button to look like a Windows button, even if the program is executed
on a Macintosh or Unix platform, you can denote your Swing program as hav-
ing the Windows look and feel. With the Windows look and feel, the Swing
program will look like a Windows program, no matter what operating system
the program runs on.
Swing components are referred to as lightweight components because
their implementation does not rely on the underlying operating system.
The JDK 1.1 version of Java defines how a lightweight component is
implemented using the Lightweight UI Framework. Because Swing
components are lightweight, their appearance is determined by you,
the programmer, and not by where the program is running.
Search WWH ::




Custom Search