RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


JavaFX Enters the RIA Race : Page 2

JavaFX Script is a new scripting language from Sun meant to provide rich user interfaces to compete with AJAX, Silverlight, and many other RIA technologies. What does JavaFX look like, how does it work, and will it succeed? Those questions and more are answered in this introductory review of JavaFX.

Set Up JavaFX
All that is required to run JavaFX scripts on the desktop is a JRE. Both Eclipse and the NetBeans IDEs already offer plug-ins to start working with JavaFX; getting set up to learn it is pretty painless.

To configure NetBeans 5.5 for JavaFX, simply use the built in NetBeans Update Center (see Figure 1). Through the OpenJFX project and web site, Sun provides step-by-step instructions on how to use the Update Center and configure NetBeans 5.5 with the JavaFX plug-in.

Figure 1. The NetBeans Update Center: Here's where to retrieve and configure the JavaFX plug-in for use in NetBeans.
Figure 2. The Eclipse Features Update: Use this mechanism to locate and install the JavaFX plug-in.

Specifically, these instructions have you install the OpenJFX implementation of JavaFX. OpenJFX is the Sun project for "sharing early versions of the JavaFX Script language and for collaborating on its development." A plug-in is also available for those that have already graduated to the NetBeans 6 Preview.

Likewise, if you're using Eclipse (version 3.2), you download and install a plug-in for Eclipse. Use the find and install option in Eclipse to download and configure the plug-in (see Figure 2).

If you'd rather not use an IDE, OpenJFX offers a download that includes the bare minimum; that is the JavaFX Script runtime, library source, and demo source code files.

Creating a JavaFX Project
Whether you're using NetBeans or Eclipse, creating a JavaFX application is the same; simply create a plain Java application. In NetBeans, use the new project wizard to create the plain Java application.

Once the project has been created, right click on the newly created project in the Projects window and select the options to create a new Class.fx file (see Figure 3). The JavaFX code is written and stored in files with a .fx extension.

Figure 3. The NetBeans Class.fx File: Right click on the Java project and select the New option.
Figure 4. The Eclipse JavaFX File: Right click on the Java project and select the New—>Other… option.

In Eclipse, it is pretty much the same process. Use the wizard to create a new Java project

After the project is created, right click on the newly created project and select the options to create a JavaFX file (see Figure 4). In the ensuing New wizard, expand the JavaFX folder, select the JavaFX file, and hit the Next button. In the next window, enter the name of the JavaFX file.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date