Resources For Learning SWT/JFace

The Standard Widget Toolkit (SWT) from the Eclipse project is a great native GUI toolkit for Java that is gaining in popularity constantly because of the Eclipse Platform‘s success.

The learning curve for this toolkit can be easier if you are careful about the sources of information you use to get started. That’s because a lot of the documents currently available online and in books are quite dated. However, since the toolkit is mostly backwards compatible, you will be safe if you don’t thread the RCP (Rich Client Platform) grounds at first and get acquainted with “basic” SWT and JFace first.

Below are some excellent resources I have regrouped that have helped me get a great headstart on the SWT/JFace API.

Online resources

IBM DeveloperWorks has a ton of great articles on getting started. Eclipse Corner also has some very good articles. I have collected links to several articles that were directly helpful to me:

  • A Gentle Introduction to SWT and JFace” is a 4-part tutorial series covering all the basics of getting an application up-and-running with SWT/JFace. It covers all the important concepts in a chronological order and contains many snippets for common constructs. Beginners start here 🙂
     
  • Using the Eclipse GUI outside the Eclipse Workbench” is a 3-part tutorial series that also covers all the basic aspects of SWT/JFace, from shells to widgets to JFace Viewers and Actions. It builds progressively on the example of a file browser similar to Window’s Explorer, with directory tree, file table and menus. The example is complete and a lot of implementation subtleties are covered through the three parts.
     
  • Understanding Layouts in SWT” at the Eclipse Corner is the definitive reference about SWT Layouts. It covers this major aspect of SWT programming with a ton of visual examples and independant snippets of code. It can easily be printed or saved as a Webpage with your browser for later perusal since it contains no sidebars or ads. Strongly recommended.
     
  • The SWT Snippets and JFace Snippets pages are essential references for the beginner and the expert alike. The vast majority of features are covered in easily digestibly nuggets of code that can be run without additionnal scafolding to experiment.
     
  • Graphics Context – Quick on the draw” at the Eclipse Corner is an introduction to SWT Graphics, the equivalent of Swing/AWT’s java.awt.Graphics class. Many screenshots document the code snippets provided. This tutorial does not cover the Advanced Graphics subsystem (equivalent to java.awt.Graphics2D).
     
  • Eclipse Forms: Rich UI for the Rich Client” at the Eclipse Corner is a complete tutorial on using the Forms API. This API allows one to create very rich form dialogs and wizards with very little effort. This article is complemented by “Eclipse Forms: New in 3.3” that covers some interesting new features that were introduced in Eclipse 3.3.
     
  • Swing/SWT Integration” at the Eclipse Corner covers the AWT/SWT bridge that appeared in Eclipse 3.2. This bridge allows developers to include Swing and AWT controls within SWT applications in a mostly transparent manner. The article describes the process and pitfalls of applying the bridge and links to the a sample helper class to get you started in using the bridge.
     
  • Java2D Under SWT: Coercing Graphics2D Functionality into SWT” is my blog article about using Java2D within SWT applications. It covers four different methods to include Java2D canvases in your SWT programs with the least amount of pain. 

Books

After discussing it with colleagues and looking-up reviews on Amazon.com, I decided to get a book so that I would have a desktop reference in my favorite format: paper :). My choice was “Java Native Interfaces with SWT/JFace” by Jackwind Li Guojie.

I was very satisfied with this title and it covers all of the essentials for getting started with plenty of snippets and a fully worked integration example. The writing style was clear and concise. Both SWT and JFace where covered, including widgets, layouts, tables, trees as well as JFace Viewers, Text, Forms and Wizards. All in all, a great title for the price. This book is also available as an e-book on Books24x7, which is a good (free) deal if you are a College Student or professional member of ACM or IEEE Computer Society.

Many other books are available, but most “classic” references cover Eclipse 3.0 or Eclipse 3.2. If you want to be cutting edge, nothing beats a little blog search or the official documentation 🙂

Other Resources

Even though the SWT official documentation is basically just the Javadoc, there is quite a lot of important information in the Platform Plug-in Developer Guide that comes with the Eclipse SDK.

Leave a Reply