Thursday, October 9, 2008

Bringing JavaFX and GWT together

JavaFX it the new kid on the Java block. There is a lot of buzz about this new technology. Although it is not quite stable yet and some people think Sun is too late to win the RIA (Rich Internet Application) market. None the less I’m a Java guy, so I just had to have a look at JavaFX. At first I had some problems to understand how things work with JavaFX. They made quite some changes to the API over the course of developing it and lots of the examples on the net are not up to date anymore. This causes some confusion and does not make things easier.

However once I got my first JavaFX code snippet running the next question was how to integrate it into a GWT website. A JavaFX application can easily be compiled into a Java applet. And that is where GwtAI come into play. Have a look at this demo to learn how to integrate JavaFX with GWT. Using GwtAI this only takes a couple of lines of code, the actual compiling and packaging things together was a bit more complicated. The JavaFX support in Eclipse is not that great, and a real pain in the ass is the fact that the GWT compiler does not work with JDK 1.6 (at least not under 64bit Linux) and the JavaFX requires a Java 1.6 environment… Argh… But I figured it out eventually.

Don't miss the demo!