Yubbin’ it up with JavaFX
I have undertaken the learning curve that is JavaFX. The company that I work for, Gieman IT Solutions, has kindly allowed me time to investigate and program in this new, up and coming technology. As a working example I have been programming a JavaFX applet that gets item results from our online classifieds site http://www.yub.com.au.
The applet hits http://www.yub.com.au with the search terms (and any other search parameters entered by the user). The server will return the set of results in XML format and the applet will parse this resulting XML sheet and display the results!
I used and manipulated some of the classes from Josh Marinacci’s 3-D Display Shelf with Perspective Transform to display the search results. It gives a really interactive and visually appealing way to scroll through potentially large result sets.
So here’s my initial impressions of Java FX:
There is a bit of a learning curve. The first couple of days of working through tutorials and examples, it takes a bit of time to decode how things are working and the nature of the language. In particular the nesting of elements. When putting together a complex scene for the first time, the forest of curly braces can be a bit overwhelming.
The event triggers are good, but there was a lack of triggers for particular individual elements – such as the the Swing Combo Box. I was expecting that this element would have onValueChanged or onSelectedChanged events. I believe the dynamics between two drop downs could be linked through binding to values – but seemed like more trouble than it was worth for a simple event based action.
I coded the applet for web/stand alone execution. When I switched this code to be run on a mobile phone, half of the code was no longer supported. Effects and the Swing libraries were not available under the mobile profile. I understand this is because the mobile is more limiting medium, but it was still kind of disappointing. For a technology pertaining that it could be used in a such universal way (phones, web, TV) this difference was an quite unexpected (unpleasant) surprise.
Design, particularly of forms, is like playing a game of Battleships – trudging through coordinates until you get it right. If you wanted to move the whole scene’s elements down 10px, you have to go to every individual element and change the y co-ordinate value by 10px. I think JavaFX will have to bring out an official WYSIWYG editor for generating the code needed to lay out all the elements the way you want them. Design is a very visual thing and trying to emulate it by typing code is not impossible, but it is painstaking.
On the flip side, programming the business logic, server requests, XML parsing and work flow were all quite straight forward and intuitive. Not being very experienced with working with or parsing XML, I found that JavaFX gave a good, understandable environment to learn in. The JavaFX environment interacts well with external data and works very nicely as a rich platform for internet applications, as it was intended to.
Grouping and binding are very intelligent mechanisms for controlling the JavaFX environment. They allow you to do many dynamic tasks and bridge the gap between frontend and backend. Quite impressively in fact.
Overall, JavaFX looks like a promising technology. I’m sure in the versions to come it will be improved and become even more powerful. It does have the power and ability to be very prominent on the web (and other mediums running a JVM) but only time will tell how far both Sun Microsystems and the budding JavaFX programmers want to take it.
VOX May 20, 2009