JavaFX 2.0

Yesterday I attended a NLJug meeting at Oracle at De Meern on JavaFX, called ‘JavaFX 2.0 EA‘. The meeting was presented by Roger Brinkley, who’s a called ‘Community leader’, of Mobile and Embedded. That he was formally part of Sun wasn’t hard to see based on his clothing and style.

Roger gave an overview of the new JavaFX 2.0, the road-map and the planned features. The software seems to be developed in an agile manner: the dead line is fixed, as is policy at Oracle (not meeting a dead line means exit for the responsible executive), but the final set of features is not.
The preview is available now for a limited audience, in May the first public beta will be released and in November the final will be available.

The most important news I heard:

  • JavaFX 2.0 will be a library (jfx.jar), rather than a separate scripting language JavaFX. The language works in the language Java of course, but you can use the language Scala, JRuby, Jython or other languages available on the JVM. JavaFX script is end-of-life. Fortunately, the syntax of the library calls is quite similar, and there’s a program to translate JavaFX script into equivalent Javacode. Curiously, the translator, FX Translator, is written in Scala.
    Update 2011-06-15: I only heard about the fx translator at the here mentioned presentation. I could find little references to the translator: a back-reference to this posting (sigh) and the fxtranslator mentioned shortly in this posting on DrDobbs.
    If you want to use the FXtranslator, you’ll have to contact Oracle for now. I guess Oracle will release the automatic translation tool in some time too.
  • The Swing-controls can be used from JavaFX 2.0. The ‘traditional Swing’ is now in maintenance mode, Oracle won’t create an new features for the original Swing library. Meaning, if you want to develop Swing applications, or more generally, desktop applications in Java now, you can best get the beta or coming GA of JavaFX.
  • JavaFX 2.0 will be available on neither the Mobiles nor Televisions! Oracle has accepted (Sun’s) loss, and will only focus on the desktop for the time being.
    JavaFX seems practical on tablet-devices. However, since most tablet devices are enlarged mobiles (running a mobile os) ratter than flattened laptops (running a full desktop os), you can’t use JavaFX on any of those devices for the time being.
  • The JavaFX is supported on the MS-Windows platform only for the coming time, (but) it will run on Mac, Linux or other platforms unsupported. This means, you might miss the hardware acceleration when not using Windows. Mind you: Roger was using a Mac while doing his presentation and demonstration the code-samples so the MS-Windows-only support might not look as dramatic as it seems at first glance.
  • Of course JavaFX runs on the JVM 6 or higher. If all goes well, JavaFX will be part of JDK 8. Before that JavaFX can be downloaded as a plugin before from java.com, which will be not to painful for users, especially if they already have some version of the Java-plugin installed.

The JavaFX SDK contains a set of sample application called ‘Ensemble’. Roger presented a few impressive programs, and showed the source code. The audience, including the Oracle employee hosting the event was very tech oriented so everyone was eager to see the code of all the nice examples.

Furthermore, Roger frequently mentioned Podcasts. I have yet to listen to them, but maybe if I have some time left. Should find a way to broadcast audio while doing the dishes.
All in all a nice event. Oracle may turn JavaFX in something that might be practical and usable on a limited number of platforms, ratter then trying to take over the world (or more specifically taking on Android, Flex, Apple IOS).

As you might notice, I’ve got no code examples or screen-shots. I hope to get access to the beta release of JavaFX 2.0, I’m quite interested in trying out all those nifty things, and expect some nice blog postings on JavaFX soon!

Update 2011-06-01: The public beta of JavaFX is out! I’ve published on JavaFX on the Xebia-blog.

5 Replies to “JavaFX 2.0”

  1. @Gerbrand
    Thank you for a very clear report. I have one for me important question to add:
    what about the web-browsers – will it be possible to run the code optionally either as a desktop or as embedded browser-code?
    As you probably know, with the JavaFX-Script they offered the possibility to elegantly drag embedded browser-code out of the browser, then to close the browser, and then to run the same code as a desktop-app. in other words, under JavaFX 1.3 it was more or less standard to write the JavaFX-app such that it could optionally run as a desktop or inside the browser.

    If I would like to be a bit negative for a moment, I could say:
    Sun had the vision to create a cross-platform supporting:
    (1) Windows
    (2) most Web-Browsers
    (3) All platforms where a JVM existed, including then of course Mac-OS, Linux etc.
    (4) Mobile phones (though the JVM-based, only, so the iPhone was a problem)
    (5) Televisions/Set top boxes

    Depending on your answer to my question above, what seems to be left over is:
    (1) Windows, and maybe (2) web-browsers,
    plus, maybe, some other JVM-based devices like Mac-Os and Linux – but, without any guarantees and support?

    Do you agree?

    I am excited about your further reports, and again, thank you.

    HHS

  2. Hi Gerbrand,

    Many thanks for sharing all this information. already we have been involved in a serious application using javafx 1.3 version . now in new version we cannot create .fx files any more. and make use of java. as you said there is a fx translator written in Scala. where to get that one. please Help.

    1. Knowing Oracle usually supports end-of-life software for quite some time, your existing software will still function quite some time. However, to be able to use new features converting to a new platform would be a good idea.
      Scala looks like a very good fit. The syntax is a bit similar to javafx (notable, the usage of the def keyword). Using the Scala features to extend the language, creating an internal DSL (domain specific language) that mimics JavaFX wouldn’t be too hard. Unfortunately I haven’t found an internal JavaFX DSL yet, and my JavaFX-script as well as Scala knowledge is slightly to limited to create one. Nevertheless, there’s a big chance someone will develop such an internal DSL eventually. This would mean the JavaFX code inside Scala can look almost like JavaFX 1.3 code, so no translation is even necessary (just copy&paste).

      This might be an interesting presentation (maybe you’ve already seen it): JavaFX with alternative languages. Not all the examples in the presentation don’t work without minor changes, the API seems to have changed since the presentation (not surprisingly, since JavaFX 2.0 was still in development). Notable, the JavaFXApplication class is now just called Application.

  3. Hi Gerbrand,
    I would like to ask you the same question as HHS:
    We have real big application that uses JavaFX 1.3 script, and we really need the FX Translator, but I can not find it.
    Can you please post link to this Translator?
    Thank you

  4. I have a big javafx script application.
    I need this translator to migrate from javafx script to JavaFX 2.0!