JAX 2009: Java goes RIA

(Disclaimer: this text was written while listening to the presentation – please be forgiving with errors that might result from both listening and writing)

I started my Java career as developer and architect for a project called “Informationssystem Lebensmittelüberwachung” (ILM for short, translated to English as “Information system for food surveillance”). I participated in that project from 1998 to 2000 and the main technology being used were Java Applets in order to implement an extremely feature rich and highly reactive user interface. Since then I somewhat have lost touch with Applets and browser based Java applications so I was very curious to finally get a glimpse of what JavaFX might offer to me during my JAX 2009 visit. So, what did I learn?

Lars Röwekamp started his talk with a small survey indicating that – while quite a lot of people looked into JavaFX – almost nobody is doing anything productive with it (with very few exceptions). He proceeded to analyze Suns Marketing, the positioning of JavaFX as the ultimate Gizmo technology for all kinds of devices and applications requiring rich clients. He also noted the similarity to the original Java mission statement.

Next he demonstrated the trivial “Hello world” examples that followed Suns hype… being a nice guy he also indicated that JavaFX today can be a lot better and really are able to offer filthy rich content (e.g. HD video, games and photo applications). He also commented several times on the rather long and tedious year long process to finally be able to do something with JavaFX (from 2007 to 2009).

From there he proceeded to actually trying to give a complete overview about JavaFX, using the JavaFX top 10 stated by Denny Coward.

His first recommendation was to start learning JavaFX using Netbeans 6.5 together with JavaFX 1.1 which seems to be the smoothest development environment currently available. He then demonstrated a neat tiny picture viewer with nice 3D effects, mirror effects, mouseover tricks and a rotating close button for a non standard window inspired by an application built by Sun engineers and modified somewhat by Lars. He noted that the effects in all cases were just 2-3 lines of code – kind of hard to do with Swing AFAIK. Additionally he demonstrated the ability of JavaFX (starting with Java 6, update 10) to use the draggable applet feature to move applications out of the browser window and onto the desktop.

Next he proceeded to a small language overview of JavaFX Script, the programming language underlying JavaFX. JavaFX Script is designed as a domain specific language for UI and graphics and uses declarative and procedural features. JavaFX Script also is a compiled and strongly typed language using actual Java and Java bytecode. He stressed the attempt to provide a rather intuitive language for describing UIs (compared to the typical Swing code jungle). He stressed the primitive “Duration” type as an important concept of timeline based applications and also demonstrated the expression language offered by JavaFX Script. He then pointed out the interesting differences between Java and JavaFX, e.g.

  • first class functions, 
  • visibility scopes, 
  • extends as a means to extend both classes and interfaces, 
  • “everything is an expression”, 
  • sequences as a means to define short forms, slices (subsets of sequences) and predicates,  
  • operators (and their somewhat different notations), 
  • flow control statements with the special ability of loops to return sequences as the expression result, 
  • public-read and public-init as new access modifiers that initially can be defined in more ways than in Java,
  • “on replace” trigger as a means to react on changes of bindings (take care: they are executed in a non-deterministic order and additionally are also executed during initialization)
  • declarative binding as a means to proactively inform variables of changes by binding complex expressions to the variables,
  • various graphics abstractions for drop shadows, etc.

For me it was quite surprising to see a number of concepts hotly discussed in various new scripting languages and once more started to wonder why Sun just doesn’t manage to finalize Java 7 in a meaningful way… on the other hand the long path towards the first JavaFX release might be an indicator for the underlying problem.

Then he talked about how to implement “beautiful graphics” with JavaFX. He mentioned

  • graphic wrappers for Java2D (for lines, rectangles, circles, etc., sometimes with additional effects like rounded borders for rectangles),
  • graphic convenience classes like shadows, light effects, transparencies, animations and 3D effects requiring on average but 1-5 lines of code,
  • scene graphs based on stages and scenes describing the UI makeup,
  • the ability to mix Swing and JavaFX elements,
  • more than 150 standardized web colors available for use and gradients including interpersed stops,
  • images and image views,
  • animations and time lines allowing for storyboards which are executed either sequentially or in parallel,
  • about 20 effects like Bloom, ColorAdjust, Reflection, Shadow, InvertMask and more which also can be combined and added to all visual elements,
  • various lighting effects,
  • group nodes in order to modify whole object (node) groups,
  • the ability style scenes with CSS stylesheets,
  • cross platform stages,
  • the ability of all nodes to react on communication and interaction,
  • caching for nodes in order to render nodes but once and then have them transparently stored as images to gain performance

He demonstrated the power of combining these functionalities by sketching out how the initially demonstrated picture application could be implemented. 

Then he had to sprint through the rich API set (e.g. codecs, multi media support, graphics and animations created by converting effects designed with Adobe tools, XML and JSON parsing with pull parsers, Swing Wrapper, web services, Java library integration and more). He noted the lack of tables – none are provided inherently by JavaFX. Quite a (bad) surprise.

He stressed that JavaFX does not contain subsets like JavaFX SE, ME or whatever for different devices but only one language. In reality there are subsets – called profiles. And if you stay with the common profile, stuff will work everywhere. Right now there only seems to exist a desktop profile which includes Swing. Which means that once you use something from Swing, you no longer will be able to run e.g. on a mobile device.

Tool integration is – as  mentioned – best with Netbeans (including debugging support), Eclipse support seems to be rather… sparse. Adobe Photoshop and Illustrator provide helpful plugins, too.

Most problematic right now seems to be the lack of ready components (e.g. no direct table support, no included media player, etc.). There are still very many things that need to be done by hand which is not really the best way to go for a product that adresses graphics intensive applications (how many developers really are able to implement beautiful and usable UIs?). But that probably just is a matter of time… if Oracle can stay interested for long enough that is…

While I had built up some negative conceptions about JavaFX I’m now actually quite impressed by some of the features provided by this language. I lack the knowledge to compare JavaFX with Silverlight, Flash, etc. so take this with a grain of salt. But it definitely tackles a number of problems I keep having with Swing and which I have used extensively over the past 10 years. And I now feel motivated to try out JavaFX. JADEFX? No, probably not 😉 My usual Sun impression seems to hold: Version 1.0 of something is a disaster, 1.1 becomes somewhat usable and starting with 2.0 you actually can do something with their stuff. That rules works for me since I lived through JSP 1.0 😉

All in all I liked the presentation a lot. Lars is a very good speaker, the presentation was well structured and provided the right level of detail for my needs (e.g. getting a good introduction to JavaFX). Only his timing could have been better – about 10 minutes before the end of the presentation he still was somewhere in item 3 of his 8 agenda items 😉 Thumbs up nonetheless – a good JAX start!

Comments are closed.