Romain Guy presented an amazing rich-client Java application at JavaOne earlier this year, and recently gave a more detailed talk about it at JavaZone 2006. He made the presentation slides available today, with a wealth of tips on creating Java apps that lead to a very rich user experience.
Romain Guy today posted his slides from yesterday's presentation at JavaZone 2006 about Aerith, a rich-client Java app.
Those familiar with his work from JavaOne earlier this year know that Aerith that takes advantage of virtually all advanced Swing features to create a Java desktop app that matches, and in some ways exceeds, what could be done with a native UI library. Aerith is a road trip blog and image sharing tool, and is implemented as a mashup that ties together three Web services: Google Maps, Flickr, and Yahoo's geocoding service.
Here is a screenshot of the Aerith UI:
A key point of Guy's presentation is that most developers have a certain mental image of desktop Java applications, not realizing that the various desktop Java APIs have progressed to a point where rich-client Java apps can truly look and act dazzling. In other words, the first step in developing for desktop Java is to raise one's expectations of the possible results.
The presentation delves into four application areas where developer expectations often fall short of current possibilities: Graphics, animation, 3D, and performance. In each of these areas, Guy points out JDK 5 improvements, and also new features slated for the upcoming Java 6 release.
In order to provide an exceptional visual appearance, he notes the use of glass panes, gradients, and the AlphaComposite. While gradients—of which a new set of APIs will be available in Java 6—provide the kind of sophisticated UI appearance common in modern desktop apps, AlphaComposite enables translucent presentation of components, and fading components in and out in response to user interaction.
Far from being a superfluous UI pizzazz, Guy notes that animations can improve usability by, for instance, making the GUI appear more responsive, and by providing better feedback to the user. However, what he talks about are non-linear animations, where a UI component, for instance, may accelerate or decelerate in the course of changing its position or appearance. Such smooth animation effects are now possible with the various Swing timer framework classes.
Rendering 3D images has traditionally been a Java sore spot, mainly because Swing did not have out-of-the-box integration with the native platform 3D libraries or with OpenGL. Most of the performance issues have been addressed in recent JDK releases, and even more features are coming in delivering 3D performance in JDK 6.
The conclusion of Guy's talk focuses on Swing performance. As in the previous segments, his main point is that developer expectations often have not caught up with the capabilities of the modern JDK platform. In addition, as there are now many ways of doing certain things in Java, knowing the right way to perform a task, such as loading images, can yield a huge performance improvement.
With the upcoming releases of new OS versions, such as those from Microsoft and Apple, users will be exposed to yet another standard of user interfaces richness. Romain Guy's demo app shows that a lot of investment and work has gone into UI-related Java APIs, with the result that Java applications will be able to live up to increased user expectations. In what types of applications do you believe it's appropriate to use such advanced UI features? Where do you think filthy-rich Java apps fit into the repertoire of an enterprise developer?
I have seen this app demo'd at some J-bruhaha. It is a beautiful app, however, one quickly realizes that this app does what it does largely by programming around most of Swing and going directly to the graphics (J2D) layer.
Which doesn't speak so well for Swing itself. The app is beyond both the ability and budget of the average IT shop though.
Actually you are quite wrong. I did write most of the UI for this application and I leveraged a LOT of what Swing had to offer. All the components, save one or two, are based on existing components and I merely changed their appearance (which I could have done by creating a look and feel for instance.)
By giving conferences and talking to developers I noticed that this app is beyond the ability of the average IT shop for one reason only: the developers don't know about all the tools the Java platform has to offer. When I ask 450 people in front of me which one know how to draw a gradient or a translucent shape, I am lucky when I get two dozens of raised hands.
I'm not saying that Swing is perfect, far from it (and I have said the contrary way too many times myself) but there are things that any toolkit can do only by means of education and this is what we try to do when creating demos like Aerith.
> I could have done by creating a look and > feel for instance.
Which would have been more useful to the community at large and is also beyond the skills of most UI developers.
> I noticed > that this app is beyond the ability of the average IT shop > for one reason only: the developers don't know about all > the tools the Java platform has to offer. When I ask 450 > people in front of me which one know how to draw a > gradient or a translucent shape, I am lucky when I get two > dozens of raised hands.
I would say that is typical of developers in general - graphics is a specialty. The platform doesn't have too much to do with it - except that J2D and Swing are incredibly badly integrated and you can circle in the documentation for hours trying to do one little thing.
Example: JComponent.paint(Graphics g) but I need a Graphics2D to do my fancy thing - how do I get one? Is it one? Can I just construct one? Its not clear. Why does Graphics2D derive from Graphics, but Rectangle derives from Rectangle2D?
I have done some fancy graphics programming in this environment and I seem to recall I spent about 3/4 of my time circling around trying to figure out how to get the appropriate J2D equivalent object or just converting Rectangle and Point types all over the place.
There's a reason your app is an aberration - it is much too expensive to try to work in this environment. By comparison, I can do the same app in Cocoa with about 1/10 the effort and time investment.
> I'm not saying that Swing is perfect, far from it (and I > have said the contrary way too many times myself) but > there are things that any toolkit can do only by means of > education and this is what we try to do when creating > demos like Aerith.
>Which would have been more useful to the community at large and is also >beyond the skills of most UI developers.
Indeed but believe it or not, we've been given a week to write this demo. I did not had the time to implement a full look and feel for it so I went the direct route :)
>I would say that is typical of developers in general - graphics is a specialty. >The platform doesn't have too much to do with it - except that J2D and >Swing are incredibly badly integrated and you can circle in the >documentation for hours trying to do one little thing.
I don't think they are badly integrated, but badly documented, yes.
>By comparison, I can do the same app in Cocoa with about 1/10 the effort and >time investment.
I have tried Cocoa and I highly doubt you can achieve your claim. I am sure you could do it faster, there is no doubt about it. But that fast, there is absolutely no way. Besides, you don't even know how much it took us to write it :)
> Indeed but believe it or not, we've been given a week to > write this demo. I did not had the time to implement a > full look and feel for it so I went the direct route :)
Fair enough - I can't blame you and I will be the first to admit it is a stunning app.
> I have tried Cocoa and I highly doubt you can achieve your > claim.
I worded that badly - I meant to say that me developing in Cocoa can beat *me* developing in Swing by probably a factor of 10.
I've done one fairly elaborate Swing app - with one graph editor component I wrote from scratch that had lovely graidents and other eye candy. I don't think I'll ever do another though as I found the experience to be very unsatisfying.
To be fair, I totally understand when you talk about unsatisfying experience with Swing. I always liked this toolkit because of its high flexibility, that I never quite found in the others (QT, wxWindows, WinForms, Tk...) True, they let you do the same kind of stuff, but in a more unpleasant way.
I really ought to learn Cocoa more, it sounds really really cool.
P.S: If you did two more advanced Swing apps, you would change your mind ;-)