At last night’s JavaOne JDK BOF, the question was posed, “What are the JDK plans for Swing?” Mark Reinhold noticed me skulking in the audience and bounced the question: “Aim?”. Caught a bit off guard, I answered a pat “it’s still there and it isn’t going anywhere”. The poser of the question stormed out (I don’t blame him), as that wasn’t the answer he wanted to hear, so I’d like to elaborate.
In working on JavaFX the last couple years and occasionally posting about it, I’m accustomed to the hate mail from Swing fans. In many ways I’m heartened by the public support for a technology on which Sun itself was so fickle. Swing is a great toolkit. It’s flexibility and extensibility enables developers to build amazingly rich and complex applications. It’s understandable that the Swing community would be incensed about the way Sun prematurely unveiled an infantile JavaFX as if it could replace 10+ years of steady enhancements and tuning of Swing & Java2D. 2007-2009 were excruciating years for all of us.
But Java and the JDK are under new stewardship now. If you’re at JavaOne or reading the tweetesphere, then you know that Oracle is deadly serious about it’s plan to resurrect Java and the JDK as the cross platform solution for the future. The proof of course will be in execution over the next year or two, but this is a practical company who isn’t suffering from an identity crisis and knows how to make money from software. A sleeper detail from Thomas Kurian’s keynote is that NetBeans will be the Java development IDE of choice going forward. This is very good news for Swing, ensuring it’s support and upkeep for a long time to come.
But that’s still not what Swing developers want to hear. Which brings me to the actual point of this rambling. User-interface technology is on a collision course with graphics. For Java to be a viable client platform in the long haul, it must be inherently capable of the sort of visual delicacies that you see in iPhone/iPad applications. As I’ve stated many times, it’s possible to achieve some of this using Java2D tricks in Swing (e.g. Kirill’s very nice Trident library), but it requires sophisticated gymnastics; it’s not a natural fit. The crux of the problem is that Swing is rooted in the antiquated AWT, rather than being integrated into the 2D coordinate system. Fixing this would require some massively incompatible changes and once you march down that path, well, you start asking yourself what other incompatible improvements should be made ….pretty soon the remodel becomes reconstruction and you realize that a new foundation is really needed.
Enter Prism. If you saw Jasper’s “Scott Pilgrim” demo at Kurian’s keynote then you’d understand what a hardware-accelerated graphics pipeline with a UI rooted in a 2D/3D scene-graph can do. Sure, most UIs won’t need to kick hundreds of rotating media cubes around, but they will certainly need to translate, rotate, fade, and blend UI elements in interesting ways. JavaFX (Prism + scene-graph + UI controls) is about making it very natural and easy to construct a modern interface and allow your graphics designers to make it pretty via CSS.
And now that we’re converting JavaFX to a proper Java library, you don’t have to learn a new language to use it. Additionally, Oracle has committed to developing the UI controls under open source and our JavaFX 2.0 development plans are very clearly layed out. Much of the JavaFX stack has already been ported off of script, so this is all quite real and the team is ecstatic to be doing Java again – it’s a far better language for toolkit development. Moving to Java should also make it vastly easier for us to support embedding JavaFX in existing Swing applications, so continued investment in Swing applications is preserved.
And to those of you who are upset that we are killing JavaFX script, I say that I feel this pain also. Like most developers who gave JavaFX script a chance, I too became an addict and will miss it as a venue for constructing applications (not libraries). But restating Richard Bair’s excellent follow-up in words from the The Princess Bride: “It’s not dead. It’s only mostly dead.” And if you’ve seen the movie, then you know that ‘mostly dead’ can be resurrected with the right loving care; I recommend attending Stephen’s Chin’s JFXtras session on Wednesday.
Many of you will undoubtedly say “it’s too late”, “developers have already moved on”. That may be the case for some developers and projects, but unlike our beloved predecessor, Oracle sells a lot of applications, and those applications will need great UIs too. It’s an ambitious plan. I don’t expect words or slick demos to change your mind. The burden of proof is now on us to deliver.