Preface

In this book, you’ll find information about the Standard Widget Toolkit, part of the Eclipse project. Eclipse is an open source Integrated Development Environment (IDE) project supported by IBM and others. The purpose of the Eclipse project is to provide a standardized development environment across platforms.

The Standard Widget Toolkit (SWT) provides a set of Java class files and native code libraries that permit the developer to deliver graphical user interfaces that completely mirror the look and feel of the target platform. If your code is executing on the MS Windows operating system, the interface elements will have the identical look and feel of applications that are compiled natively to Windows. If your code executes on the Mac OS, it will have the identical look and feel of all applications compiled natively to that platform.

What’s Inside

This book covers many widgets from the SWT, including the following components:

Shell
Menu
MenuItem
Toolbar
ToolItem
Text
Button
Combo
List
Composite
Group
Trees
Tabbed Folders
Layouts
Listeners
CoolBar
CoolItem
MessageBox
ColorDialog
PrintDialog
FileDialog

These widgets are covered in detail in the following chapters. Here’s what’s in each chapter.

Chapter 1, Getting Started

This chapter introduces the SWT and how to download and configure Eclipse to perform SWT development.

Chapter 2, SWT Shells

In the SWT the Shell class is used to create the basic window. In this chapter you learn how to create windows and manipulate their attributes to achieve the desired appearance.

Chapter 3, SWT Menus

Menus are an essential element of most GUI designs. In this chapter you learn how to create SWT menus and how to respond to the events fired when the user interacts with the menu items.

Chapter 4, SWT Toolbars

Toolbars are a companion widget for adding functionality to menus. They provide buttons that are used to initiate a specific menu action without the user navigating the menu structure. In this chapter you learn how to create and manipulate toolbars.

Chapter 5, SWT Text Fields

Text fields are used in a GUI to present information to the user or to enable the user to input information into the application. In the SWT, text fields are created using a single Text widget class. In this chapter you learn how to create and manipulate text fields.

Chapter 6, SWT Buttons

In the SWT a single Button class is used to create Push, Check, and Radio buttons. In this chapter you learn how to add buttons to your user interface and how to create each button style, as well as how to cause the button to perform the indicated task when the user interacts with it.

Chapter 7, SWT Lists

Lists (or listboxes as they are sometimes called) are used to present the user with a set of items from which to choose. In this chapter you learn how to create lists, add and delete items from the list, and determine what item or items the user has selected.

Chapter 8, The SWT Combo

The Combo (also known as the drop-down list) acts like a list, except that it takes up much less room in the GUI. This chapter looks at how to create Combo objects and interact with them as you do lists.

Chapter 9, SWT Layouts

Layouts make the task of positioning and sizing your widgets much easier than using the x and y coordinate method. SWT has four basic layout types—FillLayout, RowLayout, GridLayout and FormLayout. In this chapter you learn how to use each of these layout types.

Chapter 10, SWT Composites and Groups

To achieve complex layouts, you need to be able to do more than just add widgets directly to a window. The Composite and Group classes permit you to create “containers within containers,” which is the subject of this chapter.

Chapter 11, SWT Tabbed Folders

The tabbed folder is a very common user interface element, and the SWT makes coding them a snap. You learn how in this chapter.

Chapter 12, SWT Tables

Tables are used to display information in a grid. The SWT contains an easy-to-use Table class to assist in creating tables and populating them with data. This chapter shows you how.

Chapter 13, SWT Trees

The tree interface is a useful construct for presenting hierarchical information. This chapter shows you how to create a tree, add items and icons, and determine how the user is interacting with the tree.

Chapter 14, Other SWT Listeners

In earlier chapters you learned how to add listeners to specific widgets. In this chapter you learn how to use other common listener types not associated with a single widget type.

Chapter 15, SWT CoolBars

CoolBars are super toolbars that permit the user to move buttons from place to place. They also enable you to use widgets other than buttons to initiate actions directly from the CoolBar. In this chapter you learn how to create CoolBars, add widgets (and even other toolbars) to the CoolBar, and react to user interaction with the CoolBar widgets.

Chapter 16, SWT Slider and ProgressBar

Sliders enable the users to choose from a range of values by sliding a single widget. Progress bars are similar, except that they position the slider within a range of values depending upon program conditions. This chapter explores how to use both sliders and progress bars.

Chapter 17, SWT Standard Dialogs

As a time-saving device, the SWT provides a set of standard dialogs that automate functions such as opening a file or choosing a printer. This chapter looks at the SWT standard dialog classes.

Chapter 18, A Complete SWT Application

Throughout this book, examples are built using only a single widget type at a time. In this chapter you learn how to build a complete GUI, in the form of a text editor, demonstrating how to utilize in a production application many of the techniques shown in earlier chapters.

As with all technology, the Eclipse IDE and the SWT are subject to changes—and often rapid ones, at that. For example, just before this book was finalized, Eclipse IDE version 3 was released and all code for the book had to be retested on that platform. If you find that a more recent version of a component has been released, you should download that more recent version and check the O’Reilly web site for updates related to this book.

Get SWT: A Developer's Notebook 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.