A funny thing but one of the problems that caused the falling out between MS and Sun was that MS was writing classes to interact directly with Windows objects. Sun made a big stink because programs written using those classes wouldn't be "run anywhere".
I thought the beef Sun had with MS is that they were providing "platform specific functionality" (i.e. bindings to COM and other MS specific stuff.) inside the core classes (java.lang.*). I don't even think Swing was out yet! (Wasn't the last MS JVM 1.1.8?) If all that MS was doing was making a platform specific binding of the GUI layer they could have easily accomplished this through Swing mechanisms, and Sun wouldn't have had a problem with that. In fact, that's exactly what Apple does with its OS X look and feel... and Sun doesn't berate them for it.
As for SWT, yes, it is a direct threat to Swing. But as for not running in every JVM, I don't see how you come to that conclusion. It does require platform specific shared libraries to run, but the java classes produced *will* run in any JVM. This isn't any different than AWT... AWT requires a shared library (provided with the JRE) to be on the system to actually produce any GUIs.
I suppose the argument may be that SWT isn't "write once, run anywhere", it's "write once, run anywhere that has an SWT shared library written for it." But this same statement is true for AWT. Also, you can check here to see all the platforms SWT runs on... it's pretty close to the same platforms you can run AWT/Swing on anyway.
Although the "lumber" thread mentioned above is pretty entertaining it has been partly (mostly?) debunked in numerous online discussions, see google. SWT is a simple, high performance widget set. Swing is a higher level model-view GUI library. JFace provides some Swing-like features on top of SWT but they're not especially comparable. Everything has its place. Here are some rules of thumb I suggest for people looking at user interfaces: 1. If your primary concern is competing with native desktop applications such as Windows apps written using C++/MFC or C# then you should take a good hard look at SWT (and JFace). 2. If your primary concern is writing a program that runs the same way on Unix, Mac, PC, etc. then Swing is a good choice. 3. If you're trying to target confined platforms with old versions of Java then AWT might be a good choice. There are exceptions but that should give you a starting point.
Originally posted by Nathan Pruett: I thought the beef Sun had with MS is that they were providing "platform specific functionality" (i.e. bindings to COM and other MS specific stuff.) inside the core classes (java.lang.*).
MS had their own set of packages labeled as com.ms.x. Sun even forced them to change their IDE so that if you selected the toolbar with those widgets you got a warning message that your code wouldn't be transportable. The difference with SWT is that SWT works on a lot of OSes but that is because IBM has provided a lot of ports. If they had only provided a port to Windows would Sun be suing them? I doubt it. Swing was out at that time but it was available only as a separate download.
Joined: May 05, 2000
I don't know how "debunked" that post was but I think this is 100% truth: "In retrospect, I think the "Microsoft Java Extensions" were a good idea: you could write pretty UI's in Java. Instead of admitting that there was a real need for this, Sun went to court and never offered something competitive." That has been my complaint since 1997. AWT stinks. Swing is slow and buggy and way too complicated. If Sun hadn't been in their "we hate Microsoft" mode in 1997, C# and .NET would never have been written and former VB programmers would be using VisualStudio.Java to do their development.
Here is an interesting debate about swt/swing. http://www.logemann.info/day/archives/000008.html I've read a lot of anti-swing ranting, but it isn't that bad. Am using it in a project for frontenting with JAplet a Domino6 database (supports Java1.3). Don't even need to use slow Corba-implementation of Domino. It communicates with the Domino6 server through a lotus package which uses JNI wrappers for Lotus-RPC stuff. So far I am positively surprised with performance and speed of development (I have done more webstuff before). With good books, Netbeans and some discussion partners in newsgroups, swing looks like a good choice for a lot of smaller/mid-range projects. Would be great if I only get working that multi-Threading stuff with invokeAndWait() or/and invokeLater() to communicate with my NotesConnection class in its own thread this night or the next, to make the NotesConnection class statefull and gui-snapiness more scalable. Wise what the guy says in his weblog:
But people forget that a "fast" application is not only widget-responsiveness, in real life, applications suck at database calls and business logic, there SWTs speed wont help you in any way.
regards Axel [ July 15, 2003: Message edited by: Axel Janssen ]
Originally posted by Ed Burnette: Everything has its place. Here are some rules of thumb I suggest for people looking at user interfaces: 1. If your primary concern is competing with native desktop applications such as Windows apps written using C++/MFC or C# then you should take a good hard look at SWT (and JFace). 2. If your primary concern is writing a program that runs the same way on Unix, Mac, PC, etc. then Swing is a good choice. 3. If you're trying to target confined platforms with old versions of Java then AWT might be a good choice.
Good rules of thumb. metacomment: It is worth mentioning for historical perspective that SWT wasn't a new idea at OTI. The UI of VisualAge for Smalltalk was based on a precursor implementation of SWT called CommonWidgets. Their approaches to widget portability are similar, however SWT is simplified in many respects, owing to the experience OTI gained over the years. The arguments about the superiority of these approaches ("heavyweight" versus "lightweight" widgets) are very familiar to Smalltalk programmers -- it was covered ad nauseum in comparisons of ParcPlace's Smalltalk (lightweight) and IBM/OTI's (heavyweight). In competitive situations, customers generally preferred the more "native looking" UI. As a former Smalltalk programmer, it is interesting (and in some ways sad) that we're still debating this point over 10 years later. -- Dan
Co-author of <a href="http://www.jdg2e.com" target="_blank" rel="nofollow">The Java Developer's Guide to Eclipse</a>, 2nd Edition<br />(Yahoo group <a href="http://groups.yahoo.com/group/JDG2E/" target="_blank" rel="nofollow">JDG2E</a>)