Upgraded JavaFX Support in NetBeans IDE 6.5
For sure, one of the simplest things to do is to go to javafx.com and download the bundle "NetBeans 6.5.1 + JavaFX 1.2". But what if you don't want to re-install an existing NetBeans 6.5.1, maybe with your personal configurations and settings?
First, let me clarify a point that probably hasn't been addressed enough. NetBeans has got improved IDE support for JavaFX, beyond the SDK update - much improved, as the previous one was poor in many aspects (e.g. fix imports was often broken, you got a lot of false positive errors in the editor, etc...). For what I can see, most of these problems have gone away.
Now, there are two scenarios:
- if you have downloaded the NetBeans + JavaFX 1.2 bundle, you've got the new JavaFX support in the IDE
- if you still are running a previous NetBeans 6.5(.1) installation, you have to get the upgrade via the update center. As far I can see, the update center was installed only this morning, my local time.
To check what you have on your system, go to the "Tools / Plugins" menu and select the "Installed" tab; then type "javafx" in the "Search:" box.
You should see three plugins (if you're not seeing them, go to the "Available Plugins" tab and install them):
- JavaFX Kit: it's the IDE support for JavaFX. The latest version is 1.8
- JavaFX Weather Sample: it's a small sample application. The latest version is 1.7 - BTW, I find it not much useful, since a pack of demos with source available is on javafx.com
- JavaFX SDK (for Mac OS X in my case): it's the SDK. I think you can avoid installing this plugin if you have explicitly downloaded and installed the standalone version of the JavaFX SDK. In any case, the most recent version is 1.7
If you don't see the update, try to press the "Reload catalog" button.
Checking the version numbers and eventually performing an update is all you need to have a working system in the quickest way.
Manually configuration of JavaFX SDKs
Now, my advice for advanced people is to manualy configure the JavaFX SDK - in this way, for instance, you could have both JavaFX 1.1 and 1.2 to co-exist on the same NetBeans installation (maybe because you have decided to postpone the upgrade for an existing application, but would like to start playing with the newest one immediately).
I haven't tried it yet, but since the JavaFX SDK name doesn't include an explicit version number, I suppose that when you upgrade you loose the JavaFX SDK 1.1 configuration.
It's easy to manually configure the JavaFX SDK. Open NetBeans and select the menu "Tools / Java Platforms".
You'll see a configuration panel showing all the Java platforms installed in the IDE (JSE, JME - if enabled, and JavaFX). Of course, in the screenshot you see the JavaFX node because I had previously installed JavaFX 1.1 in the IDE.
Now push the "Add platform..." button at the bottom. A new option dialog appears:
Select JavaFX Platform and press "Next".
In the "Platform Setup" dialog, first enter a name for the new platform (e.g. "JavaFX 1.2") and then point to the directory where the SDK is installed (for Mac OS X, it's a bit quirky as usual: Library/Frameworks/JavaFX.framework/Versions/1.2/).
Now press "Finish". The new SDK should have appeared in the list of supported platforms.
You're almost done. Now open your JavaFX project and go to the Properties panel; select the "Libraries" node and select "JavaFX 1.2" (or whatever you inserted first) as the JavaFX Platform.
That's it. This worked for me with Mac OS X and Windows XP. For Linux, the option to configure a JavaFX platform appears only if you have upgraded the system (as there was no previous official support)