Chapter 7. SWT: Buttons, Text, Labels, Lists, Layouts, and Events

SWT, the Standard Widget Toolkit, was created by IBM as a replacement for both the Java Abstract Windowing Toolkit (AWT) and Swing. It’s a big topic, and it comes with Eclipse, ready to use. Here’s how the Eclipse documentation describes SWT:

The Standard Widget Toolkit (SWT) is a widget toolkit for Java developers that provides a portable API and tight integration with the underlying native OS GUI platform.

Java Graphics

Graphics work in Java has a long and glorious past, and, let’s hope, a similar future. It started with the very basic AWT, moved on through the powerful Swing package, and now stands on the threshold of the SWT age.

AWT

The AWT, Java’s first attempt at a GUI toolkit, was written in a matter of weeks. It lets Java developers display windows with various controls like text boxes and buttons. AWT GUIs were easy to develop, and they used the underlying operating system’s controls themselves—for example, in Windows, you’d see a Windows text box. On the Mac, you’d see a Mac text box. Some operating systems had a different control set from other operating systems, which meant that Sun only implemented those controls common to all operating systems Java was targeted to, and that limited AWT to a set of relatively simple controls.

Swing

To address the growing needs of developers, Java introduced Swing, which provides non-native implementations of higher level controls like trees, tables, and text. This ...

Get Eclipse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.