Fabrizio Giudici is a Senior Java Architect with a long Java experience in the industrial field. He runs Tidalwave, his own consultancy company, and has contributed to Java success stories in a number of fields, including Formula One. Fabrizio often appears as a speaker at international Java conferences such as JavaOne and Devoxx and is member of JUG Milano and the NetBeans Dream Team. Fabrizio is a DZone MVB and is not an employee of DZone and has posted 67 posts at DZone. You can read more from them at their website. View Full User Profile

Upgraded JavaFX Support in NetBeans IDE 6.5

06.05.2009
| 6775 views |
  • submit to reddit
So, JavaFX is one of the most mentioned technologies at JavaOne 2009, with even Larry Ellison to cite it as part of the strategic plans by Oracle. We have a new version, JavaFX 1.2, and people using Linux and OpenSolaris how have got support for their operating systems (even though with some quirks related to media codecs) without having to do tricky things as pacthing the version for Mac OS X. 

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:

  1. if you have downloaded the NetBeans + JavaFX 1.2 bundle, you've got the new JavaFX support in the IDE
  2. 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):

  1. JavaFX Kit: it's the IDE support for JavaFX. The latest version is 1.8
  2. 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
  3. 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)

 

Enjoy!

 

0
Your rating: None
Published at DZone with permission of Fabrizio Giudici, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Desmond Kirrane replied on Fri, 2009/06/05 - 9:46am

NetBeans 6.7 RC1 does not have the JavaFX plugin in the Available Plugins or Installed tabs. Strange.

Coffee Jolts replied on Fri, 2009/06/05 - 12:28pm

If you previously had the javafx plugin installed on 6.5, you may need to delete your modules from C:\Documents and Settings\USERNAME\.netbeans\6.5

Patryk Ry replied on Fri, 2009/06/05 - 12:40pm

Unfortunately code formatting for fx files is missing...

Fabrizio Giudici replied on Fri, 2009/06/05 - 3:19pm

@Dar Var: I believe JavaFX support for 6.7 will come later in form of a plugin. There have been a few incompatible changes in the IDE, so the plugin for 6.5 won't work in 6.7.

@PatrykRy: code formatting has been temporarily disabled because of a bug. I must say I won't probably use it: with JavaFX I'm finding that I format things in different ways in function of the context. For instance, with a large number of attributes I do:

def xyz = Foo
{
attr1: "xyz"
attr2: "xyz"
attr3: "xyz"
attribute4: "xyz"
}

while where a single attribute is present:

def xyz = Bar { attr1: "xyz" }

I've seen such a high degree of formatting variations in my code that I don't think an automated formatter is able to handle. Maybe it's just because I've still to find a style for my JavaFX coding?

Matt Coleman replied on Wed, 2013/02/27 - 1:42am

Any new version or update for JAvafx ??

buffalo ny SEO 

Cata Nic replied on Tue, 2013/09/03 - 3:11am

The FX support can be a good reason to implement this trick in your future updates. The client will be happy and you will obtain more effectiveness.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.