The AWT is a half-baked attempt to create a user interface toolbox for programmers.
Because all the various classes, containers, and widgets in the toolkit are capable of
being used both in the applets embedded in Web pages and in the stand-alone
applications on your desktop, it is a powerfully extensible tool. At the heart of this
kind of flexibility is the idea that the toolkit is an abstraction—in other words, a layer
on top of your current windowing system. This abstraction is more understandable if
you know the background behind it. When Sun was courting its early customers,
Netscape insisted that the Java Virtual Machine (JVM) included in its browser must
create widgets that had the exact look and feel of the host operating system's widgets.
Since "Swing" wasn't yet a gleam in its father's eye, the only way to accomplish this
was to use the peer components of the host operating system. Thus we can truly say
that the AWT is an abstraction of the windowing system of the operating system.
Your current windowing system may be anything from X11/Motif to Windows 95's
own window system. In any event, the AWT ensures that native calls are made to
these windowing systems in order to allow applications to run on top of the desktop.
For applets within a Web page, the browser manufacturer essentially creates a
windowing system that renders the AWT's widgets within itself.
The end result of all this is that eventually a native call is made for each action taken
by the AWT. Your applications need not be aware of this, for Java's platform
independence ensures that, no matter the platform on which you execute bytecodes,
the results will be identical.
One of the problems with this approach to user interface (UI) implementation is that
when making a UI that must be rendered the same way on all the platforms it is to be
targeted to, small differences in the way that components are rendered on each of the
targeted systems may cause the overall effect to have problems. For instance, a UI
having several closely aligned text fields may look good on Windows platforms but
appear overlayed on UNIX machines.
One of the major complaints about the AWT by people used to building user
interfaces for enterprise applications was that it had a relatively small set of widgets
and low functionality. AWT provided only slightly more functionality than the
widgets provided in HTML's forms controls. In early 1997 the work on JDK 1.1
incorporated a number of new pieces including Netscape Corporation's Internet
Foundation Classes (IFC), components from IBM's Taligent Division, and Lighthouse
Design. The first release of Swing 1.0 in early 1998 contained almost 250 classes and
80 interfaces. The art of user interface creation had been raised to a new level and was
now able to go head to head with platform-specific development tools.
The Java 1.2 platform provides a set of components (Swing) that eliminate this
problem by eliminating the use of peer components. The Swing components are pure
Java and will render reliably on all host platforms. With Swing the native look and
feel of Windows, Motif, or Mac widgets are options from a predefined list of look and
feels that are extensible by the user.
Input Alternatives