Jump to content

D Programming/DWT

From Wikibooks, open books for an open world

DWT is a port of the Eclipse/SWT (Standard Widget Toolkit) GUI library from Java to D.

You can write the code similar to SWT. For example:

import dwt.all;

void main(char[][] args)
{
    Display display = new Display();
    Shell shell = new Shell(display);
    Label label = new Label(shell, DWT.NONE);
    label.setText("Hello World");
    label.pack();
    shell.pack();
    shell.open();
    while (!shell.isDisposed())
    {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

Please compare with SWT's. For more info, see DWT project page.