| |||||||||
The SWT (or Standard Widget Toolkit) is a framework for developing graphical user interfaces in Java. Developed by the Eclipse Foundation, it represents the third main option for developers when creating desktop applications to execute on the Java platform. It uses explicitly standard Java, with the approved Java Native Interface, but the toolkit cannot be described as "pure" because of the reliance on a platform-native library for every computer on which it runs. While Java is clearly dominant on server and mobile platforms where the user interface paradigm is either highly controlled or easily subsumed, detractors of Java generally point out that where a rich desktop environment is in use, Java has not had a similar impact.
Those who support SWT observe that:
As a consequence of the above, SWT proponents contend that:
Some additional observations have been made:
Performance of Swing is hindered by an excessive amount of "object churn", creation and immediate obsolescence of large amounts of local objects.
Some open-source software distributions do not include closed-source toolkits. While the source to Java is available, this is under a license that does not permit unrestrained modification. To get around this, the GCJ compiler can be used to create executables. While GCJ can use external libraries (such as that required by SWT), it is not as yet capable of compiling Swing. Thus, those who wish to create Java desktop applications using a fully open-source software stack have no choice but to use SWT.
Critics of the SWT toolkit point out that:
Nevertheless, creating a small layer over a platform native resource is not unprecedented in Java. Hardware APIs such as that of serial or USB support simply provide a Java calling convention for the underlying hardware. In the 3D space, JOGL provides low level access for game developers with Java3D providing a higher level scene graph API. SWT has a comparable higher-level JFace API, layered onto SWT but without "hiding" it, to provide classes and functions to handle common tasks associated with programming using SWT.
IBM possessed a Java integrated development tool called Visual Age for Java. This product was open-sourced and led to the development of the Eclipse platform, with the stated intent of competing with Microsoft's Visual Studio. Rumour has it that the naming was intended to imply an "eclipse of the Sun", referring to Sun Microsystems, the developer and standards-steward of Java through the Java Community Process.
The AWT (or Abstract Window Toolkit) was the first user interface toolkit for Java. It used native peers (as does SWT) but adopted a "lowest common denominator" approach whereby widgets that were not available reliably on all platforms were not included. This was nevertheless largely suitable for the Web applet objectives of early Java versions.
Swing (or the Java Foundation Classes) were the next generation of toolkit and built on a far more contemporary object-oriented framework. Swing differs from AWT in that only a minimal amount of support is required from the host platform (basically, to provide a window). All drawing of widgets is then done from within the JRE. This allows new looks-and-feels to be plugged in during program execution. It also ensures that a desktop environment needs almost no code written to provide basic Swing support. If a Java runtime environment is available, then a default look-and-feel may be rendered enabling an application to be used.
A reputed to come from a Visual Age developer but later as a fraud nevertheless describes some possible background to the development of SWT. Swing remains the Java-standard graphic toolkit but whilst accepting the politically charged nature of SWT, proponents sometimes regard it as a sort of "AWT 2" where the graphical peer layer of Java (still available for legacy reasons) is replaced by a more modern equivalent.
Because of the penetration of Eclipse in the IDE marketplace and the correspondingly high developer awareness of SWT, moves at various levels have begun to rejoin what at face value appears to be a schism.
Oracle Corp. announced JSR 198 to unify the API for plug-in developers to ensure they need only write one plug-in to be able to target all Java IDEs. At the same time a was invoked in order to drive standards adoption. At present Eclipse has declined to join. Sun has vacillated on whether to join the Eclipse board given its existing investment in NetBeans.
Three technical integration methodologies are being pursued: