Eclipse 3.1 - New and Noteworthy in SWT

Milestone M1

Download: M1 Build (August 12, 2004)

Build Notes: M1 Build Notes

Bug Fixing

In Milestone 1, the SWT team focused on bug fixing.

Milestone M2

Download: M2 Build (September 24, 2004)

Build Notes: M2 Build Notes

Browser widget improvements

The WindowEvent notification now contains new fields addressBar, menuBar, statusBar and toolBar. The style SWT.BORDER creates a Browser with the Internet Explorer 3D border on Windows and a regular border on the other platforms. The SWT Browser widget on Linux now works with Mozilla 1.7 GTK2 as well as with previous Mozilla 1.4 GTK2 and above.

Browser Demo example

The Browser Demo example illustrates how to integrate HTML content with the Browser widget into an application.

Milestone M3

Download: M3 Build (November 5, 2004)

Build Notes: M3 Build Notes


The SWT Browser widget now lets you run javascript commands. Javascript commands can be used in a variety of ways such as accessing or modifying the Document Object Model, calling javascript functions stored in the current HTML document, etc. The commands are directly evaluated by the underlying native javascript engine (Internet Explorer on Windows, Mozilla on Linux, Safari on the Mac), in the context of the HTML document that is currently loaded in the Browser.

See the SWT snippets for examples of modifying the DOM and querying DOM node value.

The Browser Demo example now contains an 'Editor' pane that lets you input javascript commands.


On GTK+ the FileDialog and DirectoryDialog widgets will now utilize the GtkFileChooser widget if the detected GTK+ version is 2.4.10 or greater.

Milestone M4

Download: M4 Build (December 17, 2004)

Build Notes: M4 Build Notes

SWT for Solaris-GTK+

Solaris-GTK has joined the lineup of supported configurations for which SWT and Eclipse are routinely built.

GC.setLineCap, GC.setLineJoin

GC.setLineCap() lets you specify how the end of a line should be drawn. It supports the styles SWT.CAP_FLAT, SWT.CAP_ROUND and SWT.CAP_SQUARE. To specify how one line is attached to another, use GC.setLineJoin(). Possible styles are SWT.JOIN_BEVEL, SWT.JOIN_MITER and SWT.JOIN_ROUND.

See the SWT snippet for drawing lines with different cap and join styles.

New Spinner Widget

SWT now provides a Spinner widget on all supported platforms. See org.eclipse.swt.widgets.Spinner.

For more details, see the example snippet.

Mouse Wheel Events

SWT now provides events when the user spins the mouse wheel. Note that the default behaviour of scrolling the scroll bar continues to work as before. See SWT.MouseWheel.

Improved Layout support

There are new methods on Composite and Layout to allow applications to improve layout performance and to force the laying out of all children even when there is an intermediate parent that does not resize.

  • Composite.layout(Control[])
  • Composite.layout(boolean, boolean)
  • Composite.setLayoutDeferred(boolean)
  • Layout.flushCache(Control)

Selection Clipboard

Unix users on both GTK and Motif can now select text and paste it with the middle mouse button.

Milestone M5

Download: M5 Build (February 19th, 2005)

Build Notes: M5 Build Notes

Native tree with columns

The Tree widget can display multiple columns by creating TreeColumn objects. New API in Tree, TreeItem and TreeColumn provides the same support for columns as Table. This replaces the TableTree widget which is deprecated for 3.1 M5.

For more details see the example snippet.

Reorderable table columns

The display order of columns in a table can be changed by dragging the column header or can be set programmatically.

For more details see the example snippet.

Windows XP look and feel for Buttons

Under Windows XP, buttons with images now show the expected look and feel for the current skin.

For more details on Windows XP skins, see the SWT FAQ.

SWT Browser widget improvements

On Windows, new window requests can now be opened in a standalone Internet Explorer browser. A new flag required has been added to the WindowEvent notification. This flag specifies whether the platform requires the user to provide a Browser to handle the new window or if the request will open in a standalone system browser otherwise.

Eclipse RCP launcher improvements

The Eclipse launcher supports new arguments (-name and -startup) and a new configuration file to improve customization for RCP applications. For details, see the Eclipse Launcher description.

Standalone SWT download is now an Eclipse project

For developers of standalone SWT applications, the SWT component is available as a separate download. For Eclipse 3.1, the SWT download can now be easily imported into your workspace as a project.

  1. Download SWT for standalone applications. A standalone version of SWT is available on the same download page as the Eclipse SDK. Look for the section titled SWT Binary and Source. Do not extract the archive file, just save it to disk.
  2. Select Import... from the File menu.
  3. Select Existing Projects into Workspace and click on the Next button.
  4. Select Select archive file: and use the Browse button to locate the SWT standalone archive you have previously downloaded.
  5. Click on the Finish button.

The org.eclipse.swt project you have imported defines the location of the native libraries so you can run your application with the standard Java or JUnit launchers.

Starting SWT standalone applications using PDE

In 3.1, the core Eclipse plug-ins, including SWT, are packaged as single JAR files rather than as a directory of files. The SWT plug-in JAR now contains everything including the native libraries.

In order to run a standalone SWT application, the native libraries must be placed on the java library path. If you use the SWT Binary and Source download this is resolved for you but sometimes it is useful to build against the SWT plug-in from the Eclipe SDK. In Eclipse 3.0, standalone SWT developers added the native libraries using -Djava.library.path. In Eclipse 3.1, since the native libraries are inside a JAR, developers cannot easily locate the libraries.

To run and debug your SWT application using the SWT plug-in from Eclipse, you can use the SWT application launcher to locate the native libraries. A shortcut to the launcher is available in the context menu of your Java class via Run As > SWT Application.

Please note that the SWT application launcher may be unnecessary in future releases.

Advanced Graphics

New API has been added for advanced graphics operations such as path for curves and lines, alpha blending and transformations. This new API requires the Cairo Vector engine on GTK and Motif and GDI+ on Windows.

For more details see the example snippet.

New Link Widget

The new Link widget displays text containing hyperlinks.

For more details, see the example snippet.

Remove Widgets from Layout

RowData and GridData have a new exclude attribute. Setting the exclude attribute to true will remove the associated widget from the layout management - previously, applications had to dispose and recreate widgets to achieve this effect.

For more details, see the example snippet.

Milestone M6

Download: M6 Build (April 1st, 2005)

Build Notes: M6 Build Notes

Strikethrough and Underline in StyledText

Text can be underlined or a strike can be drawn through it with the new StyleRange.underline and StyleRange.strikeout fields.

For more details see the example snippet.

Spinner supports decimal values

The Spinner widget can display non-integer values using the Spinner.setDigits() API. Decimal values can be used for the minimum, maximum, increment and selection values.

For more details see the example snippet.

Emulated Table improvements

Some platforms such as Motif and Photon do not provide a native table widget and for these platforms SWT provides an emulated table implementation. In M6, this implementation was largely re-written. Many bugs were fixed and some features were enabled such as re-orderable columns and Table.showColumn().

Tree supports indices

New API has been added so that items in a Tree can be referenced by index. The index is relative to the immediate parent which for top level nodes is the Tree and for sub-nodes is the parent TreeItem. The new API includes Tree/TreeItem.indexOf(TreeItem) and Tree/TreeItem.getItem(index). In addition, you can remove the children of a tree item using TreeItem.removeAll().

Milestone M7

Download: M7 Build (May 13, 2005)

Build Notes: M7 Build Notes

Bug Fixing

In Milestone 7, the SWT team focused on performance and consistency.

Milestone RC1

Download: RC1 Build (May 27, 2005)

Build Notes: RC1 Build Notes

Bug Fixing

In Milestone RC1, the SWT team focused on bug fixing.