## SWT standalone examples setup

### Adding SWT to your workspace

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.

### Importing example source

1. Download and install the Eclipse Example Plug-ins. The Eclipse Example Plug-ins are available on the same download page as the Eclipse SDK. Look for the section titled Example Plug-ins. You can install the examples in the same location as you installed Eclipse or you can choose a different location. If you install the examples in the same location as Eclipse, the example views and editors will show up in your Eclipse environment (e.g. Windows > Show View ... > Other ... > SWT Examples If the SWT example views do not appear right away in your menu, restart eclipse with the -clean argument). This is fine but it is not necessary.
2. Select New > Project ... from the File menu.
3. Select Java Project and click on the Next button.
4. Give the java project a name such as "SWT Examples".
5. Select Create project from existing source and click on the Browse ... button to locate the following directory: `eclipse/plugins/org.eclipse.sdk.examples.source_3.1.0/src/org.eclipse.swt.examples_3.1.0`
6. Click on the Next button.
7. Click on the Projects tab and click on the Add button.
8. Place a check beside org.eclipse.swt and click on the OK button.
9. Click on the Finish button.

At this point your SWT examples should be compiled without any errors. Check the Problems view for errors. If you get an error like "`java.lang.Object` not found" it means you have not configured a JRE. Go to the Window > Preferences ... dialog and select the Java > Installed JREs preference page. Ensure that a JRE is installed and that the path to the JRE is correct.

### Running the Example

Now you can run the SWT standalone examples.

1. Open the Java perspective.
2. In the Packages view, select the main class that you want to run. For example, the main class for the Address Book example is `org.eclipse.swt.examples.addressbook.AddressBook`.
3. Select Run > Run As... > Java Application from the main menu.

### Examples Overview

Consult the documentation of each individual example for the name of its main class and additional details. The following examples are included in the `swtexamples.jar`:

- Address Book
- Browser Example
- Clipboard
- Controls
- Custom Controls
- Drag and Drop Example
- File Viewer
- Hello World [1-5]
- Hover Help
- Image Analyzer
- Java Syntax Viewer
- Layouts
- Paint Example
- Text Editor