Getting the SWT


As far as we're concerned in this chapter, what's attractive about the SWT is that it includes a Browser class that lets you create Browser widgets. So how do you get the SWT for use in your applications?

The support for the SWT is in a JAR file named swt.jar, and you can get that file simply by downloading the current Eclipse zip/tar.gz file, which contains swt.jar. Navigate to http://www.eclipse.org, click the Downloads button, and select the compressed file for your operating system. As of this writing, that's eclipse-SDK-3.0.1-win32.zip for Windows, eclipse-SDK-3.0.1-linux-motif.zip for Linux x86/Motif, eclipse-SDK-3.0.1-linux-gtk.zip for Linux x86/GTK 2, and so onthey're all listed on the Downloads page. Decompress the compressed file, which will give you the swt.jar file (along with many, many other files) you'll need for this project.

You're also going to need the precompiled native support for the SWT in order to run SWT programs. This is where the SWT's fast connection to the operating system is implemented. For example, in the current Windows version of Eclipse, those files are swt-awt-win32-3063.dll and swt-win32-3063.dll, so place them in the directory you're going to run the Browser project from. How can you find which precompiled files you need for your operating system? If you expand the Eclipse zip/tar.gz file, you'll find them in the following directories. Make sure you copy the files you find there to the directory where you're creating the Browser project (replace the 3.0.1 part in these paths with the version of Eclipse you download):

  • Win32: eclipse\plugins\org.eclipse.swt.win32_3.0.1\os\win32\x86

  • Linux GTK: eclipse/plugins/org.eclipse.swt.gtk_3.0.1/os/linux/x86

  • Linux Motif: eclipse/plugins/org.eclipse.swt.motif_3.0.1/os/linux/x86

  • Solaris Motif: eclipse/plugins/org.eclipse.swt.motif_3.0.1/os/solaris/sparc

  • AIX Motif: eclipse/plugins/org.eclipse.swt.motif_3.0.1/os/aix/ppc

  • HPUX Motif: eclipse/plugins/org.eclipse.swt.motif_3.0.1/os/hpux/PA_RISC

  • Photon QNX: eclipse/plugins/org.eclipse.swt.photon_3.0.1/os/qnx/x86

  • Mac OS X: eclipse/plugins/org.eclipse.swt.carbon_3.0.1/os/macosx/ppc

That gives you the support you're going to need to run SWT applications. So how about creating one?



    Java After Hours(c) 10 Projects You'll Never Do at Work
    Java After Hours: 10 Projects Youll Never Do at Work
    ISBN: 0672327473
    EAN: 2147483647
    Year: 2006
    Pages: 128

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net