Client-side Java's evolutionary leap

Looking back on a year of changes

Client-side Java was a source of both growing excitement and some distress in 2008, and looks to continue on that trajectory in '09. Desktop developers are basking in a shower of new releases and innovation, while also facing the possible demise of Swing, unhappy trade-offs on the Java language front, and the question of whether Sun -- or anyone -- can continue to innovate in a worldwide recession. In this round-table discussion, Jeff Friesen invites leading lights in the Java community to discuss what is most compelling to them about the current moment in client-side Java development. Read on for reflections, predictions, a modicum of polemics, and some interesting scoops about what we can expect (and when) from client-side Java in 2009.

According to a poll on Java.net, two of the biggest news stories for Java developers in 2008 were the respective releases of Java SE 6u10 and JavaFX 1.0. These were not the only significant developments for client-side Java in the past year, however, and for some what may stand out even more strongly is the still brewing controversy surrounding JavaFX as the new Swing. It also seems clear that more excitement, on the JavaFX front and from other client-side technologies, is on the way in 2009.

All of this is, of course, a huge shift from the many years when client-side Java (under the auspices of Sun) seemed to nearly stand still. In this article I attempt to consolidate and make sense of the major developments for client-side and desktop Java in the year behind us. I then look forward, to scope out what's on the horizon in 2009. Discussion is based on actual or pending product releases, official announcements, my personal observations, and the welcome commentary of influential members of the Java community. Sincere thanks to the following for their contribution to this article: Richard Bair, Tim Boudreau, Stephen Chin, Danny Coward, Joseph Darcy, Mikael Grev, Kirill Grouchnikov, Cay Horstmann, and Jim Weaver.

Reflections on 2008

Sun captured much of the spotlight shining on client-side Java in 2008. It released Java SE 6u10 and 6u11, JavaFX Preview SDK and JavaFX SDK 1.0, the LightWeight User Interface Toolkit (LWUIT), and NetBeans 6.1 and 6.5. Sun also hosted the first JVM Language Summit and, of course, the annual JavaOne conference.

Even with Sun shining so brightly, others in the Java community also made headlines in the client space. Controversy erupted over Sun's emphasis on developing JavaFX largely at the expense of continued Swing development. The OpenJDK project committed its first contribution from a non-Sun/non-ex-Sun employee. The JFXtras and WidgetFX projects debuted. Even Microsoft made some Java news.

JavaOne 2008: JWebPane, MiGLayout, 'Effective Java' reloaded

Other than announcements of the forthcoming JavaFX SDK and a cross-platform video codec from On2 Technologies, JavaOne 2008 was disappointingly light on client-side Java news. For those seeking excitement in this space, technical sessions were a better bet.

One noteworthy session introduced JWebPane, a new HTML component for Java. JWebPane provides a much-needed replacement for Swing's JEditorPane component, which renders only HTML 3.2. JWebPane is based on, and interacts with, the open source WebKit Web browser engine, which supports HTML 4, Cascading Style Sheets (CSS), JavaScript, and the Document Object Model (DOM). It takes care of Java tasks such as calculating component bounds, rendering, networking, and dispatching events, and its main JWebPane class subclasses javax.swing.JComponent. JWebPane project tech lead Alexey Ushakov announced in December that JWebPane's code should be available in a few months, preceded by an API overview. Because it's important to thoroughly vet a new API (to implement missing features or remove clutter) before integrating it into a JDK, and because the code is still under development, it seems unlikely that this highly anticipated component will make it into JDK 7.

Another session focused on Mikael Grev's popular MiGLayout layout manager. I touched base with Grev about plans for MiGLayout:

Q: Could you briefly describe this layout manager and explain why it's so useful?

Mikael Grev: MiGLayout positions components on screen using a powerful, but intuitive, domain-specific language (DSL). The popularity of MiGLayout, I believe, is that it is 100 percent optimized for the user. It has lots of built-in logic and platform rules so that the user only needs to give hints how the components are related, and MiGLayout does the rest. The Swing layout managers in the JDK use the opposite approach; they are architecturally very simple, and it is up to the user to make the decisions about gaps, positioning, and such. MiGLayout encapsulates all the functionality of almost all Swing layout managers. It also has all those nifty little extras such as resolution independence, visual debugging mode, and automatic gap and button order per platform handling.

Q: I understand that you are trying to get MiGLayout included as part of the JDK 7 core. How likely is this to happen?

Mikael Grev: I have no idea how likely it is, unfortunately. The RFE [request for enhancement] -- which is the officially most wanted one for Swing, by the way -- hasn't after one and a half years gotten an official evaluation. I think the reasons are more corporate policy than technical; they might be reluctant to overtake the official responsibility for a relatively complex software since they didn't write it in-house. But then again, that is what open source is all about. Some have voiced a concern that inclusion in the JDK would slow the development process of MiGLayout in the future. Since we are at zero known bugs and zero things to do, I don't understand how that would apply.

Q: Do you have plans for a JavaFX version of MiGLayout?

Mikael Grev: MiGLayout was made from the start to be very easy to port, and it exists officially for Swing and SWT today. It only touches the GUI framework classes through three proxy interfaces, and these are the only ones to implement to port it to a new GUI framework. So there will be a JavaFX version because it should be easy to do, and there are developers wanting it, especially because there are no real layout managers there now as I understand it. Amy Fowler (from the JavaFX team), Dean Iverson, and I are currently outlining the details on how to do this the best way.

A final highlight of JavaOne 2008 (for this developer) was the Effective Java Reloaded session, in which former Sun employee Joshua Bloch launched Effective Java, Second Edition. This successor to the popular first edition, released in 2001, offers even more insights into writing quality Java client (and server) code.

Java SE 6u10 and 6u11

It's a well-known fact that the Java client platform has for years suffered limitations that have made it a less desirable alternative to competitors such as Flash and Silverlight. For example, the entire Java Runtime Environment (JRE) must be present before an applet or Java Web Start application starts running. JREs keep getting bigger (JRE 6 exceeds 14 MB), so download times keep lengthening. To address this limitation and others, Sun engineers conceived of Java SE 6u10 (called the Consumer JRE when the early-access version came out in 2007, then Java SE 6uN). A beta version debuted in April 2008, and the final release was in October.

The following technologies in Java SE 6u10 help overcome JRE limitations:

  • Java Deployment Toolkit: Simplifies the task of deploying applets and applications to a variety of clients. It consists of a JavaScript file and a browser plugin that make it possible to install a JRE automatically.
  • Java Kernel: Lets first-time Java users run applets and applications faster by downloading only that part of the JRE needed to run the applet/application immediately. Then it downloads the rest of the JRE in the background.
  • Java Quick Starter: Prefetches portions of the JRE into a memory cache, greatly reducing the average Java Platform cold startup time (the time to launch a Java applet or application for the first time following a computer reboot).
  • New Java Plugin: Improves reliability by running applets in operating-system processes separate from the browser. If an applet fails, the browser is unaffected. Other improvements include each applet being able to increase its heap size, and improved Java-JavaScript communication.

Java SE 6u10 also includes bug fixes, Nimbus (which modernizes Java's cross-platform look and feel), a new graphics pipeline that uses Direct3D to accelerate Java2D graphics primitives on Windows, and support for translucent/shaped windows.

In December, Sun released Java SE 6u11. It focuses on security and bug fixes. A new download engine works with 6u10's patch-in-place strategy (future JRE updates are applied in the existing JRE directory so that only changed files need to be downloaded) to reduce the size of future updates. To avoid interfering with a user's Internet usage, this engine monitors that usage and throttles back its own bandwidth.

JavaFX Preview SDK and SDK 1.0

JavaFX was a source of both excitement and dismay in 2008, with three especially striking highlights. First, then-Sun employees Hans Muller and Chet Haase gave developers a peek into the Java-based scene graph and animation frameworks that would support JavaFX via Muller's Introducing the SceneGraph Project and Haase's  Been There, Scene That, Part 1 and Part 2 blog posts.

Second was the launch of the JavaFX Preview SDK on July 31. It provided a JavaFX plugin for NetBeans 6.1, which let you easily compile scripts from the IDE. The Preview SDK also provided Project Nile, whose Adobe Illustrator and Photoshop plugins made it easy for content designers to export their designs to JavaFX developers.

Third was the release of the official first version -- JavaFX SDK 1.0 -- on December 4. It included an updated JavaFX plugin for NetBeans 6.5, with refinements to JavaFX Script and new/improved APIs. We were also treated to the JavaFX Production Suite, an updated successor to Project Nile.

Many developers are now using JavaFX SDK 1.0 to create exciting applications. I spoke with JavaFX pioneer Jim Weaver (who teaches JavaFX via his book, JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications and via his JavaFX blog) about the SDK:

Q: What are your favorite JavaFX features?

Jim Weaver: One is the graphical node-centric approach, where any user interface element (button, video, image, layout, and so on) is a node in a 2D scenegraph and can be graphically transformed/animated/etc. This ability is conducive to creating the iPhone-esque/Web 2.0++ rich Internet applications that users are coming to expect. Another favorite feature is its ability to instantiate and use the millions of Java classes that already exist. JavaFX is rich-client Java, which is a huge advantage.

Q: Are there any language features or APIs that you would like to see introduced into a future version of JavaFX Script?

Jim Weaver: Because JavaFX is currently a 1.0 release, of course there are additional features and fleshing out of some current features that I'd like to see! For example, a couple of the packages in the 1.0 release are a little short of classes:
  • The javafx.scene.layout package needs more layout classes in future releases. JavaFX has a graphical node-centric user interface (think more Java 2D and less Swing), so the future layout strategies and classes need to be designed accordingly.
  • The javafx.scene.control package contains classes that provide the ability to have CSS-styled and skinnable user interface controls, but there is only one user interface control (TextBox) in that package. For other user interface controls, JavaFX uses Swing under the covers. Dean Iverson wrote an excellent article about these classes in the JavaFXpert blog, in which he builds upon a very helpful article and example by Simon Morris.
There are other features, such as a unit-testing mechanism, an easier-to-use asynchronous threading model, charting/graphing classes, and so on that are being addressed by the JavaFX teams at Sun, and by the JavaFX community. For example, an open source project named JFXtras, led by Stephen Chin, was created to address the gaps in the 1.0 release of JavaFX.

Up and coming: JFXtras

Intrigued by Weaver's comments, and by what I'd heard after the release of JavaFX 1.0, I checked in with Chin about this JavaFX release and his JFXtras project.

Q: What is your favorite part of JavaFX? What improvements to JavaFX Script, JavaFX APIs, or anything else specific to this technology would you like to see in future JavaFX SDK releases?

Stephen Chin: I would have to say that JavaFX has turned me into a bind-a-holic. I use bind for everything from user interface/model synchronization to GUI layout to inversion of control (IoC) patterns. I don't think I can go back to the old way of doing things with event listeners and getter/setter methods anymore.
1 2 3 4 Page 1