| By Bernie Spang, Dave Thomson | Article Rating: |
|
| March 1, 2003 12:00 AM EST | Reads: |
24,905 |
In his editorial "Swing Is Swinging Java out of the Desktop" (JDJ, Vol. 7, issue 10) Alan Williamson lamented the current state of Swing and AWT for building competitive desktop applications. One alternative he mentioned is a technology called SWT (Standard Widget Toolkit) that was developed as part of the Eclipse Project (www.eclipse.org). If you're wondering why the Eclipse community, led by IBM, developed SWT instead of using J2SE's AWT or Swing classes, here's the reason.
Eclipse is an open, universal platform for building and integrating development tools. The users of development tools are, typically, developers and they are a demanding lot. So Eclipse had to be designed to deliver a high-performance user experience and integrate well with native operating systems. In the early development phase of the project, the Eclipse developers found that AWT was too limited and Swing did not provide the native integration and performance they needed. Not to say that either is inherently good or bad, just that they didn't meet the requirements of this particular Java application. And that's an important point - the Eclipse platform is a Java application that runs on the J2SE platform.
As Alan pointed out in October, AWT does not provide a satisfying solution for most desktop applications. But Sun provides additional functions in the Swing classes to give Java developers the power of maximum user interface customization and cross-operating system consistency. The power of the Swing classes comes at a price, however, paid in abstraction from the operating system platform and its effect on application performance. In the case of Eclipse, it was not a priority to have an identical user interface across different platforms, but rather to maximize performance and integration and leverage each platform's capabilities. Thus SWT was born.
Swing and SWT both provide a common programming API across multiple operating systems, but that's where the similarity ends. Swing widgets are rendered by Java code, using graphics calls to "paint themselves," while SWT widgets use the operating system widgets directly via J2SE's JNI API. Since SWT is designed to embrace native window systems rather than emulate them, SWT applications have the exact look and feel of the host operating system. This means, for example, that SWT applications pick up the new Windows XP look without any code changes or delay while new emulation code is developed. This design approach also allows an application to leverage platform features such as drag-and-drop and event-merging optimizations. The result is that SWT applications truly look and perform like native applications.
SWT was developed because the Eclipse community needed a high-performance widget toolkit that integrated fully with Windows and other native toolkits such as GTK and Motif. But with the rapid and widespread adoption of Eclipse technology, many developers have found that SWT also answers an important need they have for high-performance native user interfaces in their non-Eclipse-based applications.
SWT is available for anyone to use under a true open-source license, and is developed and maintained by an open-source community. However, many Java developers feel it is time for SWT to be submitted to the JCP to bring it into the Java "fold," so to speak, as an additional user interface option. IBM would likely support a JSR that incorporates SWT as a complement to the AWT and Swing options - along the lines of how Java specifications incorporate support for other open-industry technologies such as XML and SOAP.
At the end of his editorial Alan says, "If you need your faith in Java reenergized, look to the community and what they are doing." We couldn't agree more.
Published March 1, 2003 Reads 24,905
Copyright © 2003 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Bernie Spang
Bernie Spang, director of WebSphere Studio Marketing, is a computer engineer
who led the public launch of the Eclipse project in 2001.
More Stories By Dave Thomson
Dave Thomson was one of the founding employees of Object Technology International (OTI), a company IBM acquired in 1996 and which has become the foundation for IBM's Ottawa Lab and many of the technologies underlying IBM's tool products. Prior to OTI's integration with IBM Dave served as VP Development at OTI. Dave led the teams that delivered the underlying IDE technology in many of IBM's award-winning products including: VisualAge for Smalltalk, VisualAge for Java, and the Eclipse platform. Dave was the principal architect behind the transition of IBM's internal workbench development effort into the open source project we now know as Eclipse. Dave is an IBM Distinguished Engineer and is responsible for IBM's Eclipse Development team, and serves as a director on the board of the Eclipse Foundation.
![]() |
marco marcelo 05/19/03 10:09:00 AM EDT | |||
![]() |
AW 04/08/03 07:10:00 AM EDT | |||
Alex Prayle, |
||||
![]() |
Dmitry Leskov 04/04/03 12:57:00 AM EST | |||
... that SWT in combination with one third-party tool enable GUI Java apps to be distributed as compact native Windows EXEs running without the JRE? http://www.excelsior-usa.com/jetswt.html This could have been possible with AWT/Swing apps too, if Sun JRE license was not too restricive... |
||||
![]() |
Travell Perkins 04/01/03 09:36:00 AM EST | |||
The dot com boom had to be the worst thing for client side development in general. Coding a proper client takes as much skill as any server side process. The problem is that most developers have not cultivated the proper skills for client side dev, focusing primarily on the server side and HTML clients. Further more few frameworks provide more than just a handful of widgets; Swing and SWT are both guilty of this. As far as Swing performance goes, its not a problem. I have implemented a next generation client side UI framework using IntelliJ as my dev environment and the framework is built on top of Swing. I use to code in Netbeans which is a complete dog. IntelliJ is blazing and guess what? They turn off directdraw for the Java2D subsystem by default! Note: The GDI in Windows XP is blazingly fast compared to previous implementations. Bottom line. If a Java client side application is slow blame the developer or the hardware, but leave the widgets out of it because it ain't them. As far a JTables go when designing your table models think JDBC and scrollable result sets. |
||||
![]() |
Nick Evgeniev 04/01/03 02:16:00 AM EST | |||
Hi, The first thing I have to mention SWT is not a true cross platform library. Trust me I program in both the Swing and SWT. The problem of Swing is not the speed but low qualified developers. Just try to compare borland JDeveloper (dog slow) and IDEA that runs at reasonable speed. |
||||
![]() |
Mike 03/14/03 10:01:00 AM EST | |||
Some interesting open source alternative to AWT and Swing. Support nearly all java versions (starting from 1.1) Check online demo (should work in most browsers including IE): |
||||
![]() |
Stephen Strenn 03/08/03 06:35:00 PM EST | |||
For those who believe that Swing is a great UI system, feel free to use it. Personally, I am almost GRATEFUL that SWT has come along to provide me with a UI for my Windows-based Java apps. I have now built major apps with both Swing and SWT, and the SWT user experience wins, hands down. Swing tends to be slow and frustrating. SWT is almost universally snappy and responsive. Not only that, but SWT allows me access to the wide world of ActiveX objects. In particular, I have been able to script MS Excel from within my Java app - a very useful feature for those who write business apps, since a lot of worthwhile corporate data is ferreted away in Excel workbooks. |
||||
![]() |
Michele Costabile 03/07/03 04:10:00 AM EST | |||
SWT is the right choice, abstract enough and native as it can be, it must be promoted to standard. |
||||
![]() |
Lane Sharman 03/06/03 06:41:00 PM EST | |||
Conga is Java's fastest and easiest way to create rich GUIs which are 100% Java. Have looked at SWT and Swing, and am convinced that you can get a lot better mileage out with Conga. |
||||
![]() |
Anthony 03/06/03 02:23:00 PM EST | |||
Rather than unsubstantiated opinions, has anyone actually actually done some benchmarks? I'd love to hear about even one operation well implemented on SVG and Swing in which one was better than the other. Also, if SVG really is better than Swing, is that because C++ in the O/S is faster than Java? That would be a serious criticism. Maybe adding things like C# Struts to Java would help... |
||||
![]() |
Chuck Jang 03/05/03 04:04:00 PM EST | |||
First, Eclipse doesn't promote anything- it's an open source community. Secondly, the reason there isn't a GUI Builder was for political reasons more than any other. IBM had to spare Sun the final embarrassment of releasing something that was conceptually superior to anything Sun ever released. |
||||
![]() |
Jon Perez 03/05/03 02:23:00 PM EST | |||
Considering that Swing performs nicely under Mac OS X(*), the problem seems to be that it is not Swing itself but its implementation on Win32 and Linux. Sun cares far less about Swing than Apple does it seems... pity. If it did then Swing and Java on the desktop (on the 3 major platforms - Mac, Windoze, Linux) would now probably be a lot more popular than it is right now. I don't mind the non-native L&F as the whole point of Swing is to be _cross-platform_ standard. (*) I don't know if its a memory hog under Mac OS though... |
||||
![]() |
Josh Knowles 03/05/03 10:41:00 AM EST | |||
All you have to do is look at products like IntelliJ to see that Swing can handle it, and it will only get better. |
||||
![]() |
Carlos Perez 03/05/03 10:33:00 AM EST | |||
The argument that Swing doesn't look like Windows or its native OS and therefore its a bad option is completely ludicrous. Applications these days come in all sorts of look and feel. Just look at all those multimedia players. They don't look anything like Windows. Windows XP doesn't look like Windows, people are used to seeing different kinds of windows, and guess what, people don't mind! |
||||
![]() |
Carlos Perez 03/05/03 10:30:00 AM EST | |||
A fair comparison of Swing vs SWT is to look at IDEA. IDEA is at par with Eclipse's capabilities, but its written in Swing. What the Java world needs to do, is to follow the lead of www.jgoodies.com , what that means is to make it easier to write Swing applications that look good. Swing is highly capable, the big question though is that if you're a novice, can you write something that looks nice? I think this article is born out of pure ignorance, the fact that it comes from this magazine is embarrasing. Furthermore, the Eclipse project doesn't promote the use of SWT outside of the IDEA, if it did, you would have a gui builder for SWT. If you did benchmarks on the table class for SWT, you'll find it doesn't perform as well as Swing. |
||||
![]() |
Brandon Rife 03/05/03 10:15:00 AM EST | |||
Operating systems have a look and feel that users get used to and feel comfortable with. Deviating from that L&F is asking for trouble. I'm sick of jumping through hoops to make Swing apps look, feel, and behave like native OS applications. SWT is the right philosophy - When in Rome do as the Romans...or your app will end up in the catacombs. |
||||
![]() |
Noble Paul 03/05/03 09:51:00 AM EST | |||
At some point swing might end up somewhere close to native UI in speed and performance.But it still is a memory hogging beast. Just take a look at the amount of memory consumed by the leading java IDE Intellij and Eclipse. Moreover why should the user sacrifice the look and feel which he is used to in his favourite OS. |
||||
![]() |
Chuck Jang 03/05/03 09:22:00 AM EST | |||
It amazes me that this debate is still alive. If it weren't for the relative immaturity of SWT, we wouldn't even be having this exchange. SWT is technically superior to Swing in every way that's important. If you've invested alot of time using Swing, that doesn't mean you should stay invested. The stock market thud seems like a good analogy. |
||||
![]() |
gumby 03/05/03 08:16:00 AM EST | |||
I fail to see the large-scale advantage of SWT. Extending even a simple widget (which is inevitable, except for uninteresting GUIs) is a PITA. If your sole target is windows, then why not just code in C#? And if it's not, do you really want to invest the extra cross-platform coding and testing time for SWT? Because in order to use native GUI components, you have to use the data models for those native components. I do most development on OSX, so maybe I've just never seen this "huge" speed advantage (yes, I've tried eclipse on both w32 and OSX). And a speed advantage alone has never succeeded in supplanting solutions which in the end are easier to manage or develop (VB, anyone?) |
||||
![]() |
M.Schipperheyn 03/05/03 06:45:00 AM EST | |||
Just look at any Java IDE based on Swing, e.g. JDeveloper from Oracle. Great stuff, but SLOOOOOOWWWWWW. Then check out Eclipse. Even better than JDeveloper and very comparable. Great stuff and lightning fast. To realize that all these years we have been punished with Swing and AWT while we could have had SWT (or something similar) is mind boggling. Let's hope SWT becomes part of the standard. |
||||
![]() |
Jason 03/04/03 07:36:00 PM EST | |||
In my project I am using JTable with 10,000 rows and 35 columns and the performance is quite satisfactory even on W2K PII 400Mhz 256MbRAM & JRockit 8.0. |
||||
![]() |
Alex Prayle 03/04/03 04:00:00 PM EST | |||
A JTable with an efficiently implemented TableModel can handle far more than 1500 entries with ease. I've just experimented with and editable JTable with 100000000 rows x 1000 columns, it runs without any problem and in my opinion it is very responsive. (600 MHz PIII 256MB RAM) |
||||
![]() |
Bob Bennett 03/04/03 03:43:00 PM EST | |||
I would think Sun probably needs to make an arrangement with IBM to use SWT, even if IBM supports it, instead of writing their own, but what do I know? |
||||
![]() |
Robert Sanders 03/04/03 02:10:00 PM EST | |||
Swing COULD do it, if SUN implemented a natively acclerated interface, or allowed someone else to do so they way they did with Apple's implementation of Swing accleration on OS X. If you haven't seen it, Swing is very much faster under OS X, mainly because it has a good underlying implementation. Because of the lack of such on Windows I have been heavily researching using SWT in my next desktop project. |
||||
![]() |
Glen 03/04/03 12:13:00 PM EST | |||
JGoodies are very cool I use Disk Report all the but what JGoodies do and what eclipse do are LIGHT years apart. One is a neat utility (JDiskReport) and the other is an enterprise development environment. Swing is great for simple small stuff but gets tricky with larger things. Try having a JTable with 1500 entries and see how well Swign does with that. Do it with SWT and it is wicked fast. |
||||
![]() |
Romain GUY 03/03/03 12:49:00 AM EST | |||
It will be a short message : www.jgoodies.com |
||||
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Cross-Platform Mobile Website Development – a Tool Comparison
- Three Buzzwords That Every CIO Hears but One They Should Listen To
- Write Once Run Anywhere or Cross Platform Mobile Development Tools
- Immersing into JavaScript Frameworks
- Workday Reportedly Prepping to Go Public
- Cloud Expo New York: The Java EE 7 Platform - Developing for the Cloud
- Book Review: Sams Teach Yourself Java in 24 Hours
- OpenOffice.com Lives
- Book Excerpt: Introducing HTML5
- Adobe Sends Flex to the Apache Foundation
- Five Years Waiting for JRE 7: Is It Justified? (Part 1)
- Book Excerpt: Java Application Profiling Tips and Tricks
- i-Technology in 2012: Five Industry Predictions
- It's the Java vs. C++ Shootout Revisited!
- Patterns for Building High Performance Applications
- OpenXava 4.3: Rapid Java Web Development
- The Next Web Architecture
- Asynchronous Logging Using Spring
- Java for Programmers (2nd Edition)
- Is Write Once Run Anywhere Ever Going to Be a Reality?
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- JavaServer Faces (JSF) vs Struts
- The i-Technology Right Stuff
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- What's New in Eclipse?
- i-Technology Predictions for 2007: Where's It All Headed?


















