Why bother with SWT over Swing?
Recently, I started pondering the thought of getting one of those fancy new MacBooks to replace my aging, 800Mhz TiBook. Since Eclipse has been my IDE of choice, I had to wonder; what is the state of SWT for Mac OS X on Intel? Luckily, support is planned for Intel Mac in version 3.2, which is still a beta. Incidentally, the Intel builds are currently unavailable until the Eclipse folks can get their mits on an Intel Mac in order to perform any builds.
When an OS makes an architecture shift like Apple has, it reveals the shortcomings in the SWT design. SWT depends on native code to make calls to underlying windowing system. Sure, Swing also does this on some level, but each JDK implementation has Swing support. And with the exception of GCJ/GNU Classpath, I have yet to see a JDK implementation ship without a full Swing implementation. In Apples case, when OS X on Intel came out, it supported Swing from the get go. Since SWT uses a non-standard widget implementation, it will take some extra time to get that toolkit up to speed. Furthermore, it will take some additional time after the initial release to work the all the kinks out.
But even when all of Intel support is taken care of, Mac users still won’t have access to things like the SWT to AWT Bridge, and we’re just beginning to see the Eclipse Visual Editor working on Mac OS X (But again, no real mention of how these might play out on Intel). But the next big shift comes not from an OS with a small user base, but the OS with the largest user base. The current SWT implementation on Windows is based on Win32 API/MFC which is being phased out in favor of WinFX. Granted, my knowledge of Windows programming is minimal, but from what I gather is that MFC-based applications will still function under Vista. However, it’s unclear if these applications can take advantage of Vista’s new services and if they’ll have a franken-app appearance like OS 9 apps did under Mac OS X’s Classic environment? And the bigger question, how will SWT based apps look and work under Vista?
WIth this kind of volatility with a UI toolkit, I have some trouble understanding why someone would choose the Eclipse RCP platform to develop applications on? Sure, Eclipse RCP applications on Windows are probably just swell. But if the application is going to just work on well on Windows only, why bother writing it in Java in the first place? I already mentioned the limitations of some of the SWT on Mac OS X, but things get event better on Linux. The SWT FAQ tells an awful lot. My SWT on GTK favorite: no printing. I could go on and on, but I think the FAQ speaks for itself. Sure Swing has its issues, but it certainly has been consistent, warts and all. The same can’t be said for SWT.




