Java's Swing Library, Part One
By Bruce Eckel
After seeing the huge changes that have occurred within the AWT you might still have the feeling that it's not quite done. Sure, there's now a very good event model, and JavaBeans is an excellent component-reuse design, but the GUI components themselves still seem rather minimal, primitive, and awkward. That's where the Swing: UI Component library comes in. The Swing library appeared after Java 1.1, so you might naturally assume it's part of Java 1.2. However, it is designed to work with Java 1.1 as an add-on. This way, you don't have to wait for your platform to support Java 1.2 to enjoy a good UI component library. Your users might actually need to download the Swing library if it isn't part of their Java 1.1 support, and this could cause a few snags. But it works.
Swing has all the components that you'd expect in a modern UI, including everything from buttons that contain pictures to trees and grids. It's a big library, but it's designed to have appropriate complexity for the task at hand.
Getting in the Swing
When you begin to use the Swing library, you'll see it's a huge step forward. Swing components are Beans (and thus use the Java 1.1 event model), so they can be used in any development environment that supports Beans. Swing provides a full set of UI components. For speed, all the Swing components are lightweight (no "peer" components are used), and it's written entirely in Java for portability.<>