Home Tutorials Training Consulting Products Books Company Donate Contact us

NOW Hiring

Quick links


Eclipse WindowBuilder. This tutorial describes the usage of WindowBuilder for creating user interfaces.

1. SWT Designer (WindowBuilder)

SWT Designer is a visual editor used to create graphical user interfaces. It is a two way parser, e.g., you can edit the source code or use a graphical editor to modify the user interface and SWT Designer will synchronize between both representations.

SWT Designer is part of the WindowBuilder project. WindowBuilder provides the foundation and SWT Designer adds the support for working with SWT based applications. SWT Designer supports Eclipse 3.x and Eclipse 4 RCP applications.

2. Install SWT Designer

You can install SWT Designer for the Eclipse 4.7 release via the Eclipse update manager from the following update site: http://download.eclipse.org/windowbuilder/WB/release/4.7/

Depending on your Eclipse release you should may also find it included in your release update site, e.g., http://download.eclipse.org/releases/neon

Install SWT Designer

The latest release of SWT Designer can be found on the following website: WindowBuilder download.

3. Using SWT Designer

SWT Designer allows you to open Java components in a special editor. This editor can work with parts, SWT and JFace dialogs, JFace wizards, etc.

SWT Designer allows to drag-and-drop SWT components into an existing layout, change layout settings and create event handlers for your widgets.

Showing SWT Designer main perspective

You can also use the SWT and JFace templates which SWT Designer contributes to the Eclipse IDE. For example you can use it to create Composites and add these to the Eclipse user interface. To create a new Composite select File ▸ New ▸ Other…​ ▸ WindowBuilder ▸ SWT Designer ▸ SWT ▸ Composite.

SWT Designer in Action

SWT Designer has excellent support to establish data binding between your data model and your user interface components via the JFace Data Binding framework.

4. Exercise: Getting started with SWT Designer

4.1. Installation

Install SWT Designer if you have not already done this. See Install SWT Designer for a description.

4.2. Building an user interface

Right-click on your PlaygroundPart class and select Open With ▸ WindowBuilder Editor.

WindowBuilder uses the @PostConstruct method to identify that a class is an Eclipse part. This method needs to specify at least a Composite as parameter.
// the WindowBuilder / SWTDesigner tooling
// uses methods to figure out that the
// class is am Eclipse 4 part

// one method must be annotated with @PostConstruct and
// must receive a least a Composiste

public void createControls(Composite parent) {


Switch to the Design tab in the WindowBuilder editor. This selection is highlighted in the following screenshot.

Switch to design tab in the SWT Designer

Use SWT Designer to change the layout of the Composite of the part to a s`GridLayout`.

Changing the layout with WB

Click in the Palette on Button and add a few buttons to your user interface.

Adding buttons

Add a Label and a Text field.

Adding label and text

4.3. Add a SelectionLister to your button

Assign an SelectionLister (event handler) to one of your buttons for the widgetSelected. You can to this via a right-click on the button. Select Add event handler ▸ selection ▸ widgetSelected.

Assign an EventHandler to your Button

4.4. Review the generated code

Switch to the Source tab and review the code generated by the SWT Designer.

5. Learn more about Eclipse 4 RCP development

I hope you enjoyed this tutorial. You find this tutorial and much more information also in the Eclipse 4 RCP book.

6. About this website

Nothing listed.

7.1. vogella GmbH training and consulting support


The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.

The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.

Copyright © 2012-2017 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.

See Licence.