Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
What does it mean to be a Java/JVM developer today and in the future? This blog explores Java 7+, languages on the JVM and new approaches to SDLC topics
In case you haven’t heard, JavaFX 2 is the new Desktop / web / client framework for Java. It’s had a considerable overhaul since JavaFX 1 (which was frankly not that impressive). Out has gone the custom scripting language, and instead you can write it using standard Java and an XML-based language for the actual UI presentation.
So today, a friend and I got together at one of our places to teach ourselves a bit of JavaFX. Here’s what we learned, starting with some of the yak-shaving we had to do:
/usr/local/javafx-sdk2.1.0-beta/Once it was installed, we started working with JavaFX properly. Our project for the day was to try to replicate some of Victor Grazi’s concurrency animations in JavaFX – both to teach ourselves the JavaFX technology, and also create some teaching tools as outputs.
If you’ve done any Flex development, JavaFX will seem very natural. E.g.
fx:controller attriubte, which defines the Control for this View@FXML annotationfx:id property is used to define the name of the member that is being bound to the FXML elementonAction handler, like this: onAction="#isFutureDone"#methodName syntax is used to say which method should be called when the button is pressed.From this it’s very easy to get started with building up a basic application. Some things that we found:
@FXML, then you seem to need to call requestLayout() on the UI element after updating it. We’re not sure we got to the bottom of why – please enlighten us if you know why.On the whole, we were quite impressed with our short hack session. The APIs seem clean, and the overall design of the framework seems sound. There were a few stability issues, but this is bleeding-edge tech on Mac – both the JDK and the JavaFX runtime are Developer Previews.
We’ll definitely be back to do some more with JavaFX, and look forward to seeing it mature and become a fully-supported OSS framework for client development in Java.