Over the weekend the GroovyFX 0.3 libraries were released. With this domino as well as the release of Griffon 1.0.2 I was able to update my Gr8Conf US presentation on JavaFX use only published libraries, rather than the local snapshots I had been using.
My first Session at Gr8 US this year talked about JavaFX, Groovy, and Griffon. Having watched too many episodes of Chopped I decided that my presentation needed to use the required ingredients of JavaFX, Groovy, Griffon, and Dogfood. The results are in the Gr8Cooking project on my github account. And this is an interactive presentation, feel free to click on buttons and whatnot that are actually on the slide. That was the point of this presentation.
Griffon JavaFX Archetype
This presentation also was built using the JavaFX Archetype in Griffon. The new release merely updates the required Griffon version since the latest version of GroovyFX depends on some bug fixes in the core of Griffon. To use the archetype simply use the
-archetype parameter at the command line:
Griffon JavaFX Plugin
The JavaFX Plugin was also upgraded. With the release of JavaFX 2.2 the Java Developers Kit now supports the creation of native installer and app bundles for JavaFX applications. No need to pay someone to write InstallShield scripts anymore. (There’s a reason I never mention that in my resume). Creating a native JavaFX package of your Griffon application is now insanely easy:
<app>/dist/jfxnative/bundles. Of course you can only create native bundles for the platform you are building on, and there are some required libraries for each platform you must install that vary for each platform. Oracle has the details in it’s JDK documentation.
The final piece of the puzzle is the GroovyFX library, the integration of JavaFX into Groovy. GroovyFX has upgraded in version 0.3 to require the 2.2 release of JavaFX, which includes support for the new Canvas element. Jim Clarke did nearly all the work on that piece and blogged about it a couple of months ago.
The other major feature add is the ability to reference FXML elements in a
fxml block in your Groovy scripts and code. This allows you to take an FXML file with only a visual description of the nodes and add the behavior code in the code creating the FXML, rather than in the xml declarations. It looks like this:
There are a lot of moving parts in getting a high quality JavaFX application written. But Griffon makes a point to hide the mechanical details so that you can focus on what matters: the application itself. Do you know how to convert a 64x64 PNG file into a Mac Application Icon? Griffon does, and you don’t need to.