AWT
AWT provided an API for
building graphical components such as labels, text boxes, buttons, lists, and
menus and delegated to the operating system the task of providing its specific
implementation of the component. When you build an AWT text box, the operating
system constructs its text box and displays it on the application’s window—a
Java text box on Windows looks like a Windows text box, and a Java text box on
Macintosh looks like a Macintosh text box.
SWING
■ The controls did not match the look of the platform on which they where run.
unable to keep up with changing operating systems.
■ The controls performed much worse compared to the native implementations.
ultimately an emulated component can never perform as well as its native equivalent.
A translation phase always occurs in the Java Virtual Machine (JVM), which
converts the emulated component to a set of native painting instructions.
SWT
SWT is a set of widgets that accesses the native controls through the Java Native Interface
(JNI). Only those few controls that are not present on a particular OS are emulated.
The downside of this approach is that a native library is required for each
platform on which Eclipse/SWT is deployed. However, the benefit is that applications
look and perform as well as native applications. And, as of the 2.1 release
of Eclipse, SWT is supported on most major desktop operating systems and on
the Pocket PC.

浙公网安备 33010602011771号