13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

398Chapter 17Other Ways: Alternatives to Swing$ 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$ ./HelloWorldEt voilà! You have the HelloWorld applicati<strong>on</strong>! Again. But now it is anexecutable binary. Enjoy.17.5REVIEWCompared 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 withgcj. It is part of the Eclipse project. It uses native methods that require calls todispose of allocated objects. It has a rigid hierarchy that requires that lowerlevel GUI comp<strong>on</strong>ents be linked to their parents when they are c<strong>on</strong>structed.This means there are some limitati<strong>on</strong>s <strong>on</strong> how applicati<strong>on</strong>s may be c<strong>on</strong>structed.SWT is much less comm<strong>on</strong>ly used than Swing. Swing is the lingua franca ofJava GUIs. SWT is definitely worth knowing, but if you want your skills to bemarketable, it is probably best to start with Swing.17.6WHAT YOU STILL DON’T KNOWWe just scratched the surface of SWT Widgets. There are a bunch we haven’tcovered.17.7RESOURCES• SWT was written to support the Eclipse IDE. Eclipse is athttp://www.eclipse.org/.• An introducti<strong>on</strong> 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.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!