Is Swing Dead?

I've invested years of my life in Swing development, so its a little scary to even pose the question, "Is Swing Dead?" Our largest customer, a major US bank, used to do a significant amount of Swing programming. These days all new projects are using WinForms, WPF, or Flex. All of these technologies are very good, and have big marketing bucks behind them (Microsoft and Adobe respectively.) With Sun gasping for air and IBM backing a competing toolkit, what will happen to Swing?

Replies to This Discussion

> It seems to me that GWT would be very good for AJAX web apps that are like desktop apps on the web...
Yeahp, that is a fair statement.

I actually designed and implemented a small GWT application for a large Japanese supermarket cooperative for tracking upcoming sales and their results. I purposely used layouts and widgets to form a desktop-like web application in order to give the user something they'd be used to using, like using Outlook. It felt like I was coding in Swing/AWT.

The first impression / comment from the customer was "gee, this desktop look and feel idea is nice, but can't you make it look more like a web app?" Argh.

I received quite a bit of email about this post, some of it not very flattering :-) Although I won't apologize for the question, I do want to clarify that I hope the answer is "no". Although I really enjoy working with Flex and WPF, Swing is still my favorite toolkit. Today's Swing is fast, pretty and fun.

There are a lot of things I wish Sun had done differently. Some of these errors could still be correct. Here are a few of my gripes:
- Sun should have invested in developing a best of breed L&F implementation prior to, or at least shortly after Swing's introduction. A brilliant GUI architecture can be obscured by an ugly veneer. Swing apps didn't start to look good until developers like Chet Haase and Romain Guy entered the picture. Swing still has a reputation for being ugly and slow, which is really sad because neither criticism has been true for a number of years. Sun could fix all this overnight by buying a company like Incors or by providing official support for the Nimbus project.
- Swing components are very granular, modular and flexible, which is great, but it also makes it hard for a typical programmer to put the right pieces together to produce a working application. Sun should buy a company like Jidesoft that provides a set of feature rich ready-to-go components to speed development.
- New Swing developers always struggle with how to structure their applications. The Swing Application Framework has been far too long coming. Note: I think Hans Muller is doing a great job with the current spec.
- The lack of a good browser component has always been a problem for Swing developers. Finally a small company from Tasmaniasolved the problem. Sun should buy them tomorrow!
- Sun should eat their own dog food. Why don't we have a pure Swing Java desktop?

IBM also shares blame for Swing's lack of prevalence. SWT contributes greatly to confusion in the Java desktop market. I've always contended that there was never a good reason for SWT. JetBrains IDEA proved you can build a fast and feature rich IDE in pure Swing. IBM should have worked with Sun to improve Swing rather than splitting the community. Eclipse is a brilliant project. It would be even better in Swing!

Certainly feels like it is dead. Haven't heard of much progress for quite some time now. At some point we wanted to develop a Swing based UI.. was pretty much pointless. Too much work compared to, for example, GXT, and lack of good examples online. Just like Dan mentioned, would really be cool to see something along these lines..

Even now to write something like this is still a lot of code. As a Java programmer, I would love to see this syntax in GWT, possibly using Groovy, or in JavaFX. I would also love to have code completion in IDE for this syntax, and some meaningful compile errors. It should also support code weaving and templates.

JQuery style selectors would be very helpful along with stylesheets..
$(panel).attr('border', '1px solid grey')
$(button).addClass('big-fonts')

Adding animations to this should use the same flavor.

As for libs, maven is great, but needs a polish. For example, why can't i just say
import sun.javafx.anim,
and compiler will fetch the libs for me?

I also want to deploy this code on my desktop, my web-app, and a series of mobile devices. Now all I have to do is tell my compiler to do this for me.

Hi Folks. Kostya - Excellent use of SDL :-) There have been a number of developments on the Swing front, both positive and negative, since I originally posited this question. On the negative side, JSR-296: the Swing Application Framework, has had no activity for months and clearly won't make it into Java 7. On the positive side, we have seen some great Swing related libraries and LaF implementations such as Substance and Nimbus being released. TechHui member David Qiao's company JIDE has continued to bring us best of breed Swing components and frameworks.

I think Swing's main problem is perception in the market. Sun hasn't done a good job of marketing the toolkit. I still meet developers who believe Swing is slow and ugly, which hasn't been true for years. Anyone who has tried Swing since Java 5 knows it has developed into a very mature, flexible, and powerful toolkit with excellent performance characteristics. Thanks to Nimbus, Substance and commercial LaFs such as Alloy, Swing UIs can be every bit as attractive as Flex and WPF apps.

Hopefully its not too late, and we will see renewed interest in Swing thanks to the excellent work of David Qiao, Kirill Grouchnikov and the other Swing gurus working hard to provide best of breed components, tools, frameworks and libraries. We had the opportunity to work on some very interesting Swing projects in 2008. We hope to see some new projects in 2009. That being said, we are spending most of our time with GWT and Flex.

GWT is a great alternative to building swing based applications. We have been using GWT+ GXT (3rd party lib) for about 2 years now and deployed in production. The apps are built more like a desktop L&F rather than a traditional web app and users are very comfortable using it for a little lack in the performance over the wire.

Enterprise customers have a hard time understanding the flash player to run Flex and that seems to be a major hurdle with flex (unless something has changed since I last checked the pre-requisites)

Hi Kiran, You are right - building GWT apps is very Swing-like. We are also doing a lot of GWT + GXT work. re: Flex apps, as the Flash Player has about a 98% penetration rate the need for it hasn't been a problem for us with anyone other than some military customers. Even banks tend to have Flash available on their employees desktops.

Kiran Addepalli said:

GWT is a great alternative to building swing based applications. We have been using GWT+ GXT (3rd party lib) for about 2 years now and deployed in production. The apps are built more like a desktop L&F rather than a traditional web app and users are very comfortable using it for a little lack in the performance over the wire.

Enterprise customers have a hard time understanding the flash player to run Flex and that seems to be a major hurdle with flex (unless something has changed since I last checked the pre-requisites)

We're currently working on a massive technology migration OFF flex. Sounds strange I know, but one of the limitations of flex is that it is a very *heavy* technology. Looks great, behaves great, but for international web-available products it can limit reach to areas of the globe with bandwidth and connection speed issues.

Because of this reason, South Africa's largest health care provider is investing a lot of money in rewriting their (very expensive) flex applications to HTML/jQuery equivalent solutions. I know the first thing you're thinking is that there is no way that HTML & javascript can offer the same type of interactivity and richness as flex... but lo and behold, we have done it. We've designed a series of reusable lightweight javascript components, 'widgets', which all have the same level of richness as their flex counterparts. It looks and feels almost exactly like their existing flex solutions and comes at 1/5th the weight.

Not exactly sure about SWING - I guess most desktop user interface technologies are on their way out as the mass world migration onto the web/cloud. But i don't think it's an industry that will ever disappear completely. There are plenty of large enterprises who are very dependant on swing here.