Java Champion / JavaOne Rockstar Adam Bien ( is a self-employed consultant, lecturer, software architect, developer, and author in the enterprise Java sector. He is also the author of several books and articles on Java and Java EE technology, as well as distributed Java programming. adam has posted 59 posts at DZone. View Full User Profile

Would Someone Consider To Use SWT (or another native widget library) Again These Days For Portable Platforms / Applications?

  • submit to reddit
Everything started with AWT in JDK 1.0. It came with JDK 1.0, and it used (actually uses—is still there) native widgets for rendering. I still remember the excitement, as it was introduced around 1998 (with JDK 1.2). Everyone was excited, although even the JTextFields weren't rendered correctly. Swing took the opposite approach—it rendered the components itself—so it was somehow OS independent. Only about three years later Eclipse was introduced with the SWT. It took a similar approach to AWT—because of the responsiveness problems of Swing and the native look and feel. At the time it was a viable solution for a given problem (although e.g. the performance of other Swing applications was really good). These days the responsiveness of Swing is just phenomenal (just ask IntelliJ / NetBeans users about it :-)), and Eclipse (forms) look very different to the native Windows applications (Outlook, Office, OneNote etc.). The new platforms like Flex, Silverlight, even Java FX, do not even try to achieve a perfect, native, look and feel—many nice demos just look totally different (which can be a good thing).

A native UI toolkit is harder to maintain for different platforms, because you have to test different operating systems (32 and 64 bits), and emulate some widgets, since they are not available for every given platform. So there is more effort to achieve the same goal (a decent toolkit). Furthermore, SWT can only wrap existing native widgets, so the usable API is somehow limited. It's not always fun to work with it. Just ask a developer (after a beer) with SWT / JFace experience, whether he/she really enjoys it. You will get interesting answers... :-).

Regarding the maintenance overhead and portability issues—it remains a really interesting question. Would e.g. Eclipse start with SWT again—or provide a lightweight alternative approach?


toolkit.jpeg4.17 KB
Published at DZone with permission of its author, adam bien. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Jacek Furmankiewicz replied on Wed, 2008/06/25 - 1:23pm in response to: adam bien

What are you implying? That because Swing doesn't look great on Ubuntu that is somehow Ubuntu's fault?

thanks, but no thanks.

Michael Bien replied on Wed, 2008/06/25 - 2:32pm in response to: adam bien


yes, its about time for you to install a real operating system :P

Jacek Furmankiewicz replied on Wed, 2008/06/25 - 2:37pm in response to: Michael Bien


They can take DeCSS out of my cold dead hands *grin*

yves yang replied on Thu, 2008/06/26 - 10:31am

I think it is time to push a new approach on GUI development: declarative UI programming. It can separate the UI concept with device technology such as SWT, Swing and others. Our product eFace relies on the XAML/WPF concept and developped from scratch for Java. It keeps the compatible both in syntax and semantic with XAML/WPF.

eface Architecture

For detail information, please vist our web: eFace

Jacek Furmankiewicz replied on Thu, 2008/06/26 - 10:38am in response to: yves yang

Declarative UI is great. Using XML for that is not, it's way too verbose.

 I chose YAML for the same purpose:


yves yang replied on Fri, 2008/06/27 - 3:03pm

XAML as markup language provides the folliwng advantage features over other declarative PROGRMMING language:

  1. UI design in XML can be read, transformed and reused by other solution such as Visual editor
  2. It is not a programming language, it can be used by non-software developper
  3. Easy to generate very complex UI from business model since it has really component based
  4. It is high extensible


Richard Curtle replied on Tue, 2008/07/01 - 12:01pm in response to: yves yang

The question if Eclipse would have still been build on SWT is a good one. Looking at which probably got 0.0000001% of the development man-hours SWT got I keep wondering why there is no switch. Use Swing for everything except the webbrowser and native platform integration.

This way Eclipse would also work on Linux on OSX as well as it does on Windows. I get the feeling OSX and Linux are just supported by SWT to earn the platform-independent label. But those really working with SWT/JFace/Eclipse RCP itself know that it is very very far from the platform-independency Swing established.

Steve Northover replied on Wed, 2008/07/02 - 3:42pm in response to: Richard Curtle

The idea behind SWT is to provide a native experience on all platforms, not just Windows.  When you say, "very very far", do you have personal experience here?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.