SWT standalone example - Hello World

The Hello World examples are a set of introductory examples that show how to get started on creating an application with SWT. They cover the creation of a shell, the use of event listeners, using layouts, processing events in an event loop, and drawing with a Graphics Context.

Hello World 1

This example demonstrates how to open a Shell and process the events.

Hello World 2

This example builds on HelloWorld1 and demonstrates how to display a Label inside of the Shell.

Hello World 3

This example builds on HelloWorld2 and demonstrates how to use a listener mechanism to resize the Label when the Shell size changes.

Hello World 4

This example builds on HelloWorld2 and demonstrates how to use a Layout to resize the Label when the Shell size changes.

Hello World 5

This example builds on HelloWorld1 and demonstrates how to draw directly on an SWT Control using a Graphics Context.

Running the example

Follow the SWT standalone examples setup instructions to install and run the example from your workspace.

The "Main" class is org.eclipse.swt.examples.helloworld.HelloWorld[1-5].

This example can also be run using the Example Launcher. Select one of the Hello World items from the Standalone category and click Run.