summaryrefslogtreecommitdiffstats
path: root/examples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html
blob: 3ded90f15b2d9d661f83f4676ce1e5ac0004b670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title>SWT Standalone Examples Setup</title>
</head>
<body>

<h2>SWT standalone examples setup</h2>

<h3>Adding SWT to your workspace</h3>

<ol>
<li>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 
<strong>SWT Binary and Source</strong>.  Do not extract the archive file, just save it to disk.
<li>Select <strong>Import...</strong> from the <strong>File</strong> menu.</li>
<li>Select <strong>Existing Projects into Workspace</strong> and click on the <strong>Next</strong> button.</li>
<li>Select <strong>Select archive file:</strong> and use the <strong>Browse</strong> button to locate the SWT 
standalone archive you have previously downloaded.</li>
<li>Click on the <strong>Finish</strong> button.</li>
</ol>

<h3>Importing example source</h3>

<ol>
<li>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 <strong>Example Plug-ins</strong>.
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. <strong>Windows &gt; Show View ... &gt; Other ... &gt; SWT Examples</strong>
If the SWT example views do not appear right away in your menu, restart eclipse with the <strong>-clean</strong> argument).
This is fine but it is not necessary.
<li>Select <strong>New &gt; Project ...</strong> from the <strong>File</strong> menu.
<li>Select <strong>Java Project</strong> and click on the <strong>Next</strong> button.</li>
<li>Give the java project a name such as "SWT Examples".</li>
<li>Select <strong>Create project from existing source</strong> and click on the <strong>Browse ...</strong> 
button to locate the following directory:
&nbsp;&nbsp;&nbsp;&nbsp;<code>eclipse/plugins/org.eclipse.sdk.examples.source_3.1.0/src/org.eclipse.swt.examples_3.1.0</code>
<li>Click on the <strong>Next</strong> button.</li>
<li>Click on the <strong>Projects</strong> tab and click on the <strong>Add</strong> button.</li>
<li>Place a check beside <strong>org.eclipse.swt</strong> and click on the <strong>OK</strong> button.</li>
<li>Click on the <strong>Finish</strong> button.</li>
</ol>

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

<h3><a NAME="Run"></a>Running the Example</h3>

<p>Now you can run the SWT standalone examples.

<ol>
<li>Open the Java perspective.
<li>In the Packages view, select the main class that you want to run.  
    For example, the main class for the Address Book example is 
    <code>org.eclipse.swt.examples.addressbook.AddressBook</code>.
<li>Select <strong>Run</strong> &gt; <strong>Run As...</strong> &gt; <strong>Java Application</strong> from the main menu.
</ol>


<h3>Examples Overview</h3>
<p>
Consult the documentation of each individual example for the name of
its main class and additional details.
The following examples are included in the <code>swtexamples.jar</code>:
</p>
<ul>
<li><a href="swt_addressbook_ex.html">Address Book</a>
<li><a href="swt_browser_ex.html">Browser Example</a>
<li><a href="swt_clipboard_ex.html">Clipboard</a>
<li><a href="swt_controls_ex.html">Controls</a>
<li><a href="swt_customcontrols_ex.html">Custom Controls</a>
<li><a href="swt_dnd_ex.html">Drag and Drop Example</a>
<li><a href="swt_fileviewer_ex.html">File Viewer</a>
<li><a href="swt_helloworld_ex.html">Hello World [1-5]</a>
<li><a href="swt_hoverhelp_ex.html">Hover Help</a>
<li><a href="swt_imageanalyzer_ex.html">Image Analyzer</a>
<li><a href="swt_javaviewer_ex.html">Java Syntax Viewer</a>
<li><a href="swt_layout_ex.html">Layouts</a>
<li><a href="swt_paint_ex.html">Paint Example</a>
<li><a href="swt_texteditor_ex.html">Text Editor</a>
</ul>

</body>
</html>