135
CHAPTER 4
The Standard Widget Toolkit
The Standard Widget Toolkit (SWT) is a thin layer on top of the platform’s
native controls. SWT provides the foundation for the entire Eclipse user inter-
face (UI). This chapter begins with some history and philosophy of SWT, and
then dives into using SWT to build applications. It covers most of the widgets
commonly encountered and the layout managers used to arrange them within
a window. The chapter concludes with a discussion of various resource man-
agement issues to be considered when using SWT.
4.1 SWT History and Goals
The roots of SWT go back more than fifteen years to work that Object Technol-
ogy International, or OTI (then an independent pioneering OO software com-
pany and now a part of IBM), did when creating multiplatform, portable, native
widget interfaces for Smalltalk (originally for OTI Smalltalk, which became
IBM Smalltalk in 1993). IBM Smalltalk’s Common Widget (CW) layer provided
fast, native access to multiple platform widget sets while still providing a com-
mon API without suffering the “lowest common denominator” (LCD) problem
typical of other portable graphical user interface (GUI) toolkits.
For many years, IBM had been using Smalltalk as its “secret weapon”
when building development tools (even IBM’s first Java IDE, VisualAge for
Java, was written in Smalltalk); however, Smalltalk had deployment and con-
figuration problems that ultimately doomed its long-term use at IBM.
Java’s promise of universal portability and ubiquitous virtual machines
(VMs) on every desktop was very appealing to the folks at IBM responsible
QualityEclipse.book Page 135 Friday, November 7, 2008 10:42 AM