Eclipse vs. Swing
Awareness of toolkit trade-offs can help you decide which Java GUI is the right one for your application
by Daniel F. Savarese
December 2002 Issue
I've never been a fan of integrated development environments (IDEs), but there's no doubt that many programmers find them useful. Even though I do not use IDEs on a daily basis, I make a point of keeping up with the latest product offerings. You've got to keep an open mind in the software business, and I'm not going to avoid using a tool that will make me more productive.
Eclipse, one of the more recent Java IDEs, has been creating quite a stir. Not only is it open source software—distributed under the Common Public License—backed by an impressive consortium of companies, including IBM and Borland, but also, despite being implemented in Java, it does not use a single line of Abstract Window Toolkit (AWT) or Swing code. Rather than ask why the members of the Eclipse Consortium, noticeably missing representation from Sun Microsystems, decided to jointly develop an IDE when many of its members already had IDE products, I want to discuss the Eclipse GUI implementation decision that has rekindled the debate over how best to implement cross-platform user interfaces in Java.
Eclipse is not just a Java IDE. To borrow the words of its creators, "Eclipse is an open platform for tool integration." It is implemented in Java but not restricted to Java development tasks. Much like Microsoft's Visual Studio, Eclipse allows you to write your own tools that integrate with the IDE. In this way, Eclipse can be extended for any software development purpose. The unit of extension is called a plug-in. The componentization of Eclipse is so great that virtually every unit of functionality is implemented as a plug-in. In fact, many plug-ins can be plugged out, so to speak, and used independently. This was the approach used to implement the Standard Widget Toolkit (SWT), which forms the basis of user interface development for plug-ins. You can write Java applications that use SWT to implement their GUIs without requiring the Eclipse IDE to host them.
SWT is a basic graphics and widget toolkit for Java. It has no dependencies on graphics code from the Java core APIs. Eclipse also provides an additional toolkit, called JFace, that builds on top of SWT, providing more complex widgets and high-level functionality such as image and font registries. Together, SWT and JFace replicate the functionality provided by Swing and a subset of the Java Foundation Classes. It is significant that a consortium of companies with large financial stakes in the success of Java would opt to design their own cross-platform GUI toolkit to implement a substantial application rather than use the one provided as a standard part of the Java platform. Also significant is that some Java developers are adopting this toolkit in lieu of Swing to build their applications. Let's see why you might consider following suit.
Back to top
|