JavaFX provides a powerful Java-based UI platform capable of handling large-scale data-driven business applications. JavaFX 2 is a major update to the JavaFX platform. Starting with this version, developers can create JavaFX applications completely in Java. This document describes how to set up a JavaFX-enabled Java platform that will enable you to start developing JavaFX 2 applications in NetBeans IDE.
To follow this tutorial, you need the following software and resources.
|Software or Resource||Version Required|
|Java Development Kit (JDK)||7 update 10 or more recent|
|JavaFX SDK (cobundled with JDK)||2.2.4 or more recent|
If you want to upgrade from one version of JavaFX 2 to another (for example, from JavaFX 2.1 to JavaFX 2.2.x), it is safest to uninstall the older version of JavaFX 2.
Manually uninstall the old version and make sure its directories are deleted. The JavaFX installer does not always uninstall older versions of JavaFX 2 correctly, which can lead to the wrong version being used.
Additionally, you might encounter problems if the new JavaFX SDK location differs from the old location. The existing default JavaFX-enabled platform would still point to the old location. In this case, open Tools > Java Platforms, delete the old default JavaFX-enabled platform and create a new default JavaFX-enabled platform using the updated version of JavaFX 2.
NetBeans IDE requires a JavaFX-enabled Java platform in order to use JavaFX 2.2.4. This section describes how to create a JavaFX-enabled Java platform in the IDE.
NetBeans IDE attempts to create a JavaFX-enabled Java platform when you choose a JavaFX project in the New Project wizard or when you open an existing JavaFX project for the first time. A warning appears if the IDE cannot create the JavaFX-enabled Java platform automatically. In this case you must create the JavaFX-enabled Java platform manually. You can create additional JavaFX-enabled Java platforms, for example, if you want them to use a different Java JDK.
The procedure in this section is divided into the following two parts, to reflect automatic and manual Platform creation.
The first step in creating a JavaFX-enabled Java platform is to open the IDE's New JavaFX Application wizard. (Alternatively, you may open the New JavaFX Preloader wizard.) If the IDE does not find a JavaFX-enabled Java platform, the IDE attempts to generate a JavaFX-enabled Java platform. If the IDE successfully generates a JavaFX-enabled Java platform your setup is complete. If the IDE does not generate a JavaFX-enabled Java platform, you must create a platform manually.
To open the New JavaFX Application Wizard:
You need to create a JavaFX-enabled Java platform manually if you want a JavaFX-enabled platform based on a Java JDK other than the JDK that the IDE uses by default. For example, your IDE uses Java JDK 1.6.0 update 37 on Windows, but you want to build JavaFX applications using Java JDK 7 Update 11.
To create a JavaFX-enabled platform manually:
After you set up NetBeans IDE to use JavaFX 2.2.4, try to do the JavaFX tutorials as NetBeans projects.
Back to the Learning Trail