Swing Is Swinging Java Out of the Desktop
Swing Is Swinging Java Out of the Desktop

Over the last few months I have made more than a passing reference to the fact that I personally feel that, in its present state, Java doesn't stand much chance on the desktop against the march of Microsoft's WinForm technology from the .NET Framework. A view, I have discovered, shared by many of you. Before I go on, let me clarify my position here so we are all on the same page. The frameworks currently available to the Java developer from the standard JDK, of course, are AWT and Swing. Naturally we are not talking about other client-side technologies, such as SWT, Thinlets, and Droplets to name a few, but more on them later.

The less said about AWT the better. It doesn't even stand up to the functionality of an HTML page with a basic FORM embedded in it. But we were told not to despair, Sun promised a much better technology was in the works. We were then presented with Swing, which definitely looked the part. However, while academically a sound design, in reality it is a dog-slow technology that suffers from far too much abstraction and object creation to be practical. Swing applications require a lot of memory and a lot of horsepower to get anywhere with them. I know there are some great examples of Swing applications, and 9 times out of 10, I am shown Forte and other heavy weight IDEs, which conversely are great examples of how much stress Swing really does put on the desktop.

There are some great analysis pieces on why Swing is slow and impractical on many Java forums around the planet, but I urge you to check out some of the discussions on JavaLobby and Slashdot. You will notice the conspicuous absence of many counter arguments.

I have already mentioned in a previous editorial how we've missed the boat with applets and how Macromedia have stolen Java's thunder with their Flash technology. It grates on my nerves every time I surf to a particularly Flash-heavy site, as this was the precise role Java was promised to deliver. I strongly believe that AWT lost us this battle, and Swing was far too heavy to be anywhere near a browser to be even considered in the running.

The title of my editorial (sadly not mine but from a poster to our Ask JDJ feature) sums it up very well: If Swing is our only hope then boy are we in trouble!

However do not despair. I have news - great news - about Java on the client side. We may have lost the first round of battles, but the war is still to be fought. We can't rely on Sun to offer us help here (in fact I am awaiting an e-mail back from the tech lead at Sun for client -side Java, who is still to defend their Swing position), so we have to look to third parties for their efforts. You won't be disappointed.

The first technology I would love to tell you about is an effort from an individual buried deep within Europe, www.thinlet.com. This is a very lightweight GUI framework, with very rich widgets that you can easily use. You describe your front-end using XML and building up an applet is very quick and easy. The size of the framework is 30KB. That's it! Check out his Amazon demo and please e-mail if you aren't impressed. This is why Java is so exciting and shouldn't be underestimated.

The second technology is the Standard Widget Toolkit (SWT) from the Eclipse project. This is a little heavier than the Thinlet technology and is there to build applications that would ordinarily be installed on the desktop. This is a direct competitor to Swing, and from all reports, does a much better job. By all accounts, running their Eclipse IDE on a 400Mhz machine whips along and is very fast, in stark contrast from running an equivalent Swing application within the same constraints.

If you need your faith in Java re-energized, then look to the community and what they are doing. If you are waiting on Sun, then don't, they are too busy fighting Microsoft than to worry about the actual technology they supposedly fighting for!

About Alan Williamson
Alan Williamson is widely recognized as an early expert on Cloud Computing, he is Co-Founder of aw2.0 Ltd, a software company specializing in deploying software solutions within Cloud networks. Alan is a Sun Java Champion and creator of OpenBlueDragon (an open source Java CFML runtime engine). With many books, articles and speaking engagements under his belt, Alan likes to talk passionately about what can be done TODAY and not get caught up in the marketing hype of TOMORROW. Follow his blog, http://alan.blog-city.com/ or e-mail him at cloud(at)alanwilliamson.org.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 6

We're all kidding ourselves if we turn our heads and accept the performance that swing provides. Swing was clearly developed in a very elegant way, however, it is resource intensive and therefore does not provide a crisp user experience. Those of you who mentioned TogetherJ and Neatbeans as examples of "high performance" java apps have to be kidding. I use TogetherJ daily. I have a laptop with 600M of ram and it brings it to its knees. Furthermore I have to reboot my machine after I use it.

I'm a huge fan of Java, but I'm also a realist. Its obvious that the Java platform will eventually have to find an alternative to Swing in order to succeed on the desktop. In days to come, this will matter. As fans of Java, we're fortunate that Microsoft has been(past tense) so far behind in recent years and that server side programming has been the standard.

We use Swing instead of HTML/Javascript partly because of the data validation, not just for the neat screen.

How about SVG/XUL? Do they provide any easy way to data validation function? I doubt that?

My boss want to find a solution for the data-entry oriented application. Any idea?

try www.nexaweb.com...
SVG/XUL is the way to go...!


Man, if this was TV, are the ratings high? cuz this write-up might have topped the last. This reminds me of The Jerry Springer show.

Oh, back to the PIE.
I think a small percentage of folks
know how to make Java programs perform fast. And an even smaller percentage that make client-side GUI apps. And an even smaller percentage with both combined.

I've been developing in Java since its inception. I've learned that good design makes software last, and that you can always make things run faster. Swing is very robust and now fast. Believe it or not you still have to build things that aren't in the JDK. That means you have to think hard. You still have to build an application framework. Like caching Manager, thread pools, Using Swing's model interfaces instead of Default implementations, Java NIO, Singleton patterns, Factory patterns, obf, your own classloader, etc. I use to develop MFC applications. M$ made a mess with C++, OOP, (message mapping eek!) and those wizards. I don't want to go back to that. VB was simply good for prototyping or small apps. Swing is hard to learn but well worth it. It is easier than VC++, and more robust than VB. One more thing... When you write great applications the user doesn't care if it was Ansi graphics or Java.

I don't care about what others think.
Webstart and Swing is were I'm going.

check out:


Swing is definitely huge, slow, and complex from my perspective. Fortunately, I have little or no use for it, since most of my work is browser-based UI.

Seeing Swing, I have to say, why bother with a Java based GUI at all? Why not build your GUI in native code, and use JNI to write your business logic in Java?

That is very true: you could justify the use of Java for a nice grid displayed to the user, but the users would be much better served with a grid (build in C+ or C++) component and run from a Perl script.

The point of Swing is NOT, imho, to be the performance absolute. It's Java, for goodness' sake - that means a Swing app should look and act the same regardless of where it's deployed. Swing does that fairly well. Thinlets leverage things Swing does, too, so using them as an example is a little disingenuous. I know programmers who can make Swing sing, even though I'm not one of them; I think Swing suffers from stupid programmers instead of bad impl.

I am used to developing in the Microsoft environment (oooh, I must be a bad guy ...) and I have recently gone out on the Web "shopping" for free trial versions of IDE's for developing web services for the sake of comparison. I downloaded Sun's ONE (formerly Forte)and IBM's Websphere, to talk about those two. On my K6-2 300 256 MB RAM machine (I know, this does not "meet" the minimum requirements of Sun ONE), Sun ONE was just not workable. Just sliding along the menu bar was painful, as the environment couldn't keep the pace showing me the various menu options. IBM's Websphere, in contrast, showed a very responsive environment. If one can't work with ONE, I figured, then let's not bother trying it out. It is a pity because some of the features of Sun ONE are really exciting. I just never made it to convincing me buying another 256 MB of RAM (and changing my CPU!) just to try Sun's environment.

Yes it's true that swing isn't going to replace Windows anytime soon..so what. In the future users will login to their Portal ..note desktop irrelevant. Users will run multiple apps thru this interface...some of the applications will be java, some Cold Fusion, some Citrix, some .Net but all will use same security models, same look/feel, etc. By the way Cold Fusion and other easier languages will be doing 80% of the development over Java anyway....as Java is for PHD's primarily who have a year to learn it....ain't going to happen that Java is the 'primary' it's too hard.

Loser. Get a life.

Swing is a good GUI from the programmers standpoint. But unfortunatly, a Swing application looks awkward and clumsy. I want my program to shine. Why is a BMW Z3 roadster I nice car - because it looks good. The exterior reflects its interior. I want my program's excelent internal functions to be matched by a good look & feel. If Java/Swing cannot deliver that, it'll be forever doomed on the desktop. Java/Swing is easy and fun but when it comes to beauty you'll have to resort to Eclipse SWT. Otherwise you can forget selling it in competition with native applications.

The link below lists a variety of different technologies for creating rich user interfaces via XML markup (XUL, thinlets, JellySwing etc).

I think that is most definitely the future. Then multiple client side technologies can be supported from HTML, DHTML, proprietary MS stuff, XUL (which works natively in Mozilla and there are various other XUL clients out there) as well as Swing, SWT and Flash.

There are already many different client side technologies available; I don't see one single winner so I think we should focus more on writing for all of them (or at least some of the best ones).

I just can't see how Java has gone so far in acceptance, having so many (all better) alternatives. For 99% of the applications, performance-wise, you can use scripting languages (Perl, Python, etc) to do what is being done (at great expense) with Java.
And this is all I have to say about Java.

Well, Swing may be slow/broken on other platforms, but it's actually quite good on Mac OS X (J2SE 1.3.1). You get very good performance, mostly because Apple did such a good job integrating it into the drawing environment.

Indeed, it's my understanding that Apple is working with Sun to integrate back into the primary sources many of the ideas Apple had to accelerate the performance of Swing.

Should be good news for folks, come time for J2SE 1.5 or so.

Of course, if you switch to Mac OS X, you get it today.


Manolete, Manolete, si no sabes, "pa que te metes". Este buen señor, es uno más de los fantásticos gurús que florecen everywhere. Me apuesto un cataplin a que no ha utilizado ninguna de las herramientas ni escrito una sola línea utilizando Swing de un applet de gestión como "Dios manda".

Saludos a los Swing Man y que no os desanimen "artículos" como los de este bendito panplinas. bye!

Feedback Pages: