Skip to main content

Why I choose SWT against Swing

Posted by aiqa on November 19, 2004 at 12:01 AM PST

For the Jeopardy project, I have been searching for the right toolkit. Swing is a well known, already tested option while SWT stands there as a sparkling, brand new toolkit, which has been the building blocks of Eclipse. I always knew that it would be a hard choice.

SWT, Standart Widget Tooklit is developed for Eclipse platform. The SWT component is designed to provide efficient, portable access to the user-interface facilities of the operating systems on which it is implemented. As it may be understood form this sentence SWT uses native libraries to drow its widgets to the screen. In every platform that your software will work, there must be these libraries already provided. There is no problem for Linux, MacOs and Windows operating systems at the moment.

SWT is faster than Swing because it uses native request.
You have to include 1.5 mb of library with your application if the targeted platform does not have these.
Your application will seem as an application written in c. There will be no visual differences.
You can also develop applications for PDA`s. (Does not make any sense for Jeopardy?)

On the other hand Swing has been used for years. With Java 5.0 there are new properties added to swing. There is already a crowded community who works on/with swing.

I searched google for "java swt" keywords and found 287.000 entries. For "java swing" I found 2.850.000 entries.

I searched for the books at for swt and swing. The results were the same as google. Lots of books for swing, a few books for swt. As you may understand this is just because SWT is newer than swing. These results show that there is less documentation for SWT.

One advantage of SWT is, it is used in Eclipse workbench and has an active community. There are lots of plugins added to Eclipse and new improvements are made every single day.

With the documentation I found for SWT I could easily create a form with standard components. It seems that SWT is easy to learn. Below you can find visual components comparision.

Table 1: Comparing visual components

Component SWT Swing AWT
Button X X X
Advanced Button X X  
Label X X X
List X X X
Progress Bar X X  
Sash X X  
Scale X X  
Slider X X  
Text Area X X X
Advanced Text Area X X  
Tree X X  
Menu X X  
Tab Folder X X  
Toolbar X X X
Spinner X X  
Spinner X X  
Table X X X
Advanced Table X X  

Being an Eclipse user, I choose SWT for the Jeopardy project because I want a fast interface which seems as a native application on Linux (also on poor windows). I also want to create native binaries which can be done by modifiying Eclipse run parameters.

You can read more about SWT before making your choice, these are the references I used.

Have a nice UI :)

Ozgur Akan

Related Topics >>