Java Reference
In-Depth Information
$ gcj -classpath=~/eclipse/plugins/org.eclipse.swt/swt.jar:\
~/eclipse/plugins/org.eclipse.swt/swt-pi.jar -c HelloWorld.java
$ gcj -main=HelloWorld -o HelloWorld Hello.o swt.so
$ export LD_LIBRARY_PATH=.:~/eclipse:\
~/eclipse/plugins/org.eclipse.swt/ws/gtk
$ ./HelloWorld
Et voilà! You have the HelloWorld application! Again. But now it is an
executable binary. Enjoy.
17.5
R EVIEW
Compared to Swing, SWT is a somewhat simpler GUI library. Unlike Swing,
it is Free Software and Open Source. It provides a full GUI library for use with
gcj . It is part of the Eclipse project. It uses native methods that require calls to
dispose of allocated objects. It has a rigid hierarchy that requires that lower
level GUI components be linked to their parents when they are constructed.
This means there are some limitations on how applications may be constructed.
SWT is much less commonly used than Swing. Swing is the lingua franca of
Java GUIs. SWT is definitely worth knowing, but if you want your skills to be
marketable, it is probably best to start with Swing.
17.6
W HAT Y OU S TILL D ON ' T K NOW
We just scratched the surface of SWT Widget s. There are a bunch we haven't
covered.
17.7
R ESOURCES
• SWT was written to support the Eclipse IDE. Eclipse is at
http://www.eclipse.org/ .
• An introduction to SWT can be found at the same site:
http://www.eclipse.org/articles/Article-SWT-Design-1/
SWT-Design-1.html .
• Part 2 of the same article is at http://www.eclipse.org/articles/
swt-design-2/swt-design-2.html .
Search WWH ::




Custom Search