Skip to main content
summaryrefslogtreecommitdiffstats
blob: fe96fa02012350a70cde074e4cd66719d6353d99 (plain) (blame)
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
91
92
93
94
95
96
97
98
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <title>SWT Standalone Examples Manual Setup</title>
</head>
<body>

<h2>Standard Widget Toolkit (SWT) - Standalone Examples Manual Setup</h2>

<h3>Setup</h3>
<p>There are several steps required to run the SWT standalone examples manually.
</p>

<ul>
<li><p>
Create a Java Project to contain the examples.&nbsp; Call it <b>SWT Examples</b>.
</p>

<li><p>
Make sure the <b>swt.jar</b> file is on the java classpath, by doing the following:<br>
Select the SWT Examples Project and bring up the Properties dialog.<br>
On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select <b>swt.jar</b>.<br>
Next, click on the Attach Source button, then click on the Browse File System button and select <b>swtsrc.zip</b>.<br>
The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
<ul>
<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt\
<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt/
</ul>
Click OK to save the Project properties.<br>
</p>

<li><p>
Make sure the <b>swtexamples.jar</b> is on the java classpath, by doing the following:<br>
Select the SWT Examples Project and bring up the Properties dialog.<br>
On the Java Build Path page, select the Libraries tab, click on the Add External JARs button and select <b>swtexamples.jar</b>.<br>
Next, click on the Attach Source button, then click on the Browse File System button and select <b>swtexamplessrc.zip</b>.<br>
The files can be found in the following directory, depending one which Operating System you are using to run Eclipse:
<ul>
<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt.examples\
<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt.examples/
</ul>
Click OK to save the Project properties.<br>
</p>

<li><p>
Make sure that referenced libraries are visible in the Packages view, by doing the following:<br>
In the Packages view of the Java Perspective, drop down the View menu.<br>
Ensure that <b>Show Referenced Libraries</b> is checked.
</p>

<li><p>
Make sure the <b>SWT runtime library</b> is in the library search path, by doing the following:<br>
In the Packages view of the Java Perspective, expand <b>swtexamples.jar</b>.<br>
You will see all of the packages and other resource files present in the jar file, including the executable class for each example.<br>
Select the executable class (the one containing the main() method) for the particular example that you wish to run and bring up the Properties dialog.<br>
On the Execution Arguments page, select the VM arguments field and enter <b>-Djava.library.path=&lt;runtime-library-path&gt;</b>.<br>
The runtime library path is the following directory, depending on which Operating System you are using to run Eclipse:
<ul>
<li>Windows - &lt;install-dir&gt;\eclipse\plugins\org.eclipse.swt\os\win32\x86 (or org.eclipse.swt\ws\win32 in Eclipse 1.0)
<li>Motif - &lt;install-dir&gt;/eclipse/plugins/org.eclipse.swt/os/linux/x86 (or org.eclipse.swt/ws/motif in Eclipse 1.0)
</ul>
Click OK to save the Java Resource properties.<br>
</p>

</ul>

<h3><a NAME="Run"></a>Running the Examples</h3>
<p>In the Packages view of the Java Perspective, expand <b>swtexamples.jar</b>.&nbsp;
You will see all of the packages and other resource files present in the jar file,
including the executable class for each example.
</p>
<p>All of the standalone SWT examples are intended to be run as Java
Applications.&nbsp; No parameters need be passed to any of these examples,
other than any required VM arguments.&nbsp; To run an example, simply
select the executable class for the particular example, then click the Run button on the toolbar.
</p>

<h3><a NAME="Package"></a>Examples Manifest</h3>
<p>Consult the documentation of each individual example for the names of
its executable class(es) and additional details.
</p>
<p>
<code>swtexamples.jar</code> contains the following examples:
<ul>
<li><a href="swt_addressbook_ex.html">Address Book</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 Viewer</a>
<li><a href="swt_texteditor_ex.html">Text Editor</a>
</ul>
</p>

<p><br><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corporation 2000, 2001.  All Rights Reserved." BORDER=0 height=12 width=195></a>
</body>
</html>

Back to the top