Sun setting down on the core Swing

November 5th, 2008

Core Swing is in the process of being retired as a legacy UI technology inside Sun, and last week has marked another sad (yet expected) milestone. According to Jeanette Winzenburg‘s post on the SwingLabs forum, Sun has stopped funding of the SwingX project.

Announced at JavaOne 2004 under the JDNC brand, SwingLabs has been widely considered as a breeding ground for modern UI technologies (new components, markup language, binding etc) for later inclusion in the core JDK distribution. It has enjoyed significant attention from the Swing community, drawing dozens of outside developers to contribute code and discuss various approaches to provide modern, rich and customizable components. Perhaps the culmination of these discussions happened in 2006 around the painters. The community members (IMHO) have truly believed that SwingX is being officially regarded inside Sun as a gateway for those contributions to find their way into the core Swing, and the level of excitement was clearly visible throughout the well argumented and heated discussions about the painters.

In my view, the turning point has come in January 2007 when it was announced that Sun unilaterally has decided to remove the entire painter layer from SwingX. This has effectively destroyed the trust of external contributors, who never came back, even after Sun developers have retired themselves from being involved in the project. In this light, Amy’s comment on Jeanette’s thread is a little misguided:

SwingLabs isn’t being shut down and SwingX isn’t going anywhere — it’s a great extensions library that exists because the community drove the development in the direction they needed. I don’t see that ending.

In fact, that single internal decision that completely disregarded the whole year of discussions was the most unfortunate moment in the project’s history. Looking back, it is even more unfortunate since SwingX components are not going to be part of core Swing (more on this later). Up until that moment the community has believed that it had an equal say in the development direction. After that moment most of the community has left, and a few months later Sun has decided on the new direction – JavaFX.

I don’t know what the future holds for JavaFX. Sun is heavily betting on it, and nobody wants to have their Nomad moment forever archived on the Internet. All i know is that JavaFX has effectively halted all core Swing development. Over the last 18 months, we have seen significant architectural initiatives (JSR 295 and JSR 296) changing leads and frozen. All client-facing improvements in Java2D, AWT and Swing in Java 6 Update 10 are completely driven by the requirements of JavaFX. In Richard’s own words (the same thread on SwingX funding):

Swing is part of the JDK. It isn’t going away any time soon. For a great many large enterprise applications Swing is the best cross platform toolkit available. We’ll continue to support and work on fixing bugs in the JDK.

It can’t get any clearer – the only two active areas of Swing core work is support and bug fixing. You might say that things will change once JavaFX 1.0 is out the door, but this is quite unlikely. JavaFX has a lot of ground to cover if it is to compete with Adobe and Microsoft, and it has even more ambitious plans for mobile and set top environments. In Richard’s words:

Definitely no question that there is a lot of working going into JavaFX and will continue to happen.

What do i see happening? I think that the current core Swing feature set should be considered frozen, until shown otherwise (not in words, but in actions). Swing is an extremely well written and customizable UI toolkit, and it is a solid candidate when you consider writing your next UI application. However, the innovation must come from third-party developers, be it binding, application framework, components or markup language. As the Swing Links trail on this blog shows, there is a lot of external activity in this area.

I think that core Swing has become a victim to Sun’s outdatedly rigid policy on the backwards compatibility. I have written about this topic in the Substance users mailing list a few weeks ago:

The eternal fear of Java core libraries is to never break existing applications (by the way, the Swing forums are rife with examples of applications that break when migrated to a newer JDK versions; it doesn’t have to be EDT violations, something as simple as event firing condition due to a bug fix is enough). This fear has us stuck with Ocean as the default look-and-feel. This fear has us stuck with tons of deprecated APIs that unnecessarily complicate the learning curve for the novice users (how many ways to catch an Enter key on text field?) This fear has us stuck with obsolete layout managers (gridbag, spring). And by the way, this fear also prevents the core developers from adding new functionality out of the fear itself that they might get it wrong the first time and get stuck with it forever.

Like i said before, in the grand scheme of things, it all doesn’t matter. Technologies die, new technologies are born, people move to other companies, old prejudices refuse to die and some decisions are forced on technical people. The customers, of course, couldn’t care less about all this.