Note: This website is archived. For up-to-date information about D projects and development, please visit


For general information about SWT see

The TioPort repository has this directory structure beneath

  • swt-3.2.1-linux-gtk/
  • swt-3.2.1-win32/
  • swt-3.2.1-macosx/

Building the examples

  1. In the moment i suggest to check out the whole repository trunk.
        svn co tioport
    or any other SubVersion? client: TortoiseSVN, RapidSvn?, KSvn, ...
  1. See the README for build instructions and dependencies

Simple Examples

Minimum HelloWorld

There are 3 differences between this D version and the Java version:

module minimumhelloworld;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.StaticCtorsSwt;
import dejavu.lang.String;

// (1) dummy function to access compiled-in resources (here we do not use this feature)
extern(C) ubyte[] resources_getDataById( char[] aId ){
    return null;

void main(char[][] args) {
    // (2) initialize SWT

    Display display = new Display();
    Shell shell = new Shell(display);

    shell.setText(String.fromUtf8("Hello, world!")); // (3);

    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {

  1. To simulate Java resources, the port has a special mechanism. At least this dummy function has to exist to make the linker happy.
  2. A manual call to initialize the SWT is required. This does also trigger the initialization of dejavu.
  3. String literal need to be converted to the Java equivalent String class.


This is simple wizard dialog. The application is not a automatic ported. This sample was taken from and converted to D manually.

Screenshot Wizard (linux-gtk)

The official SWT examples

The following examples are the official SWT examples from


The paint example is a little painting program. All icons are build into the executable.


There are implementation in dejavu missing to have the full function of this example. e.g. storing the addressbook to a file and loading it.
see #5

Drag and Drop


Controls Example

The controls example is compilable, but it is not working. This is because this example makes use of dynamic invocation of reflected methods. At the moment I don't know how to implement these invocation mechanism in dejavu.



Show various controls, each with a tooltip.

In the Screenshot the hover help is shrinked to the window border, since I did not know how to make the screenshot :). #7


The Graphics example shows 4 different graphics.

  • two diagonals crossed
  • a star pattern with the option to fill the polygons (choose background)
  • animated dot increasing size
  • the intro, showing a "SWT" going animated over a picture: Screenshot Graphics (linux-gtk)


in the moment, there is an effort of porting poseidon to tango/SWT. See this page poseidon