JavaFX has a very rich language and set of APIs which have changed quite a bit on their way to the 1.0 release. If you wrote code with the preview release last July, or an even earlier release, then you will notice that your code no longer compiles. If you'd like to update your old code, then this is the blog for you. It would be impossible to list everything that has changed (even since the preview release in July), but here is a quick list of the big changes and a link to learn more.
Step 1: Make sure you have the new NetBeans 6.5 + JavaFX SDK bundle. Tons of things have changed so you *must* have the new bits.
Step 2: If you have an existing JavaFX project, when you open it be sure to change the JavaFX SDK used to the latest one in your Project Properties.
Step 3: Compile and see what breaks. Here's what I typically change, in order:
attributetovaroperationtofunctionprivateto nothing. variables are private by default nowstatic, move static functions and variables outside of your class definition- change
javafx.uiimports tojavafx.scene. (if you have code from back then) javafx.scenetojavafx.scene.*we split out lots of packages. For example, images are injavafx.scene.image, and colors are injavafx.scene.paintjavafx.inputtojavafx.scene.inputFrame,WindowandDialogare gone. Usejavafx.stage.Stageinstead.Canvasis gone, usejavafx.stage.SceneinsteadSystem.out.printlntoprintln.printlnis built in now, so you don't need the Java version.
For a more detailed list of changes please read Stephen Chin's blog entry on the topic. Stephen has moved a rather large codebase, WidgetFX, so he put together a very comprehensive summary. Thanks Steve!
I somehow don't feel comfortable with the JavaFX Script. It must have been much easy if JFX Script must have derived from Java syntax and keywords.
Posted by Kishore on December 09, 2008 at 02:40 AM PST #
The script is really straight forward to pick up, give it a try before you pass judgement, its quite powerful.
And the changes from Preview to Release make things easier, I was quite confused by the Preview release and stopped mucking around with it, but I've made a lot more progress with the final version.
Simplifying everything to a Stage was good (I just think, "all the worlds a stage...")
Posted by Steven Herod on December 11, 2008 at 02:51 AM PST #
Thank you for thinking of the early-adopters. I have a full fledged app written in 2007 FX, so a transition recipe is very helpful. Some of us had faith early on...
Posted by Robert Casey on December 12, 2008 at 03:26 PM PST #
I somehow don't feel comfortable with the JavaFX Script. It must have been much easy if JFX Script must have derived from Java syntax and keywords.
Posted by Tiffany Earrings on October 20, 2009 at 01:13 AM PDT #