Java, 一杯浓浓的咖啡伴你到深夜

SWT, Swing or AWT: Which is right for you?

A look at AWT

Abstract Windows Toolkit (AWT) is the original Java GUI tool kit. AWT's main advantages are that it comes standard with every version of Java technology, including Java implementations in old Web browsers, and it is very stable. This means you do not need to install it, you can depend on it being available everywhere you find a Java runtime environment, and it will have the features you expect.

A look at Swing

Java Swing, also known as a part of the Java Foundation Classes (JFC), was an attempt to solve most of AWT's shortcomings. In Swing, Sun created a very well-engineered, flexible, powerful GUI tool kit. Unfortunately, this means Swing takes time to learn, and it is sometimes too complex for common situations.

A look at SWT

SWT is a low-level GUI tool kit comparable in concept to AWT. JFace is a set of enhanced components and utility services to make building GUIs with SWT easier. The builders of SWT learned from the AWT and Swing implementations and tried to build a system that had the advantages of both without their disadvantages. In many ways, they succeeded.


In most cases, the decision is between Swing and SWT combined with JFace. In general, each of these tool kits is complete and powerful enough to build full-function GUIs, but Swing is generally superior to SWT alone (used without JFace). Swing has the advantage of being built into Java technology, is completely portable, and arguably has a better architecture. Swing also has the advantage for advanced graphical applications. SWT has the advantage of being implemented as a native application which increases the performance and native compatibility of SWT-based GUIs.

If you are developing only for one platform, SWT has an advantage in host compatibility, including integration with host features, such as use of ActiveX controls under Windows.

The original (full version) article:

posted on 2006-02-28 19:29 Scott@JAVA 阅读(346) 评论(0)  编辑  收藏 所属分类: Jave SE 6