What is JavaFX?
According to the "all knowing
Wikipedia"; "JavaFX is a software platform for creating and delivering
rich Internet applications that can run across wide variety of
connected devices. The current release (JavaFX 1.2, June 2009) enables
building applications for desktop, browser and mobile phones. TV
set-top boxes, gaming consoles, Blu-ray players and other platforms are
planned." JavaFX is not an API for GUI development, but rather a
platform that uses a declarative programming language called JavaFX
Script. To have a quick view of the possibilities, take a look at the samples on javafx.com
Getting started with Eclipse Sun has a "getting
started" tutorial that looks okay over at javafx.com. It's worth
noticing that there s no mention of how to get started with Eclipse (of
course). I've heard a lot of praise of Netbeans lately, but learning
something new, and a new IDE at the same time is not what I wanted. I
started my adventure and downloaded the 45 MB JavaFX SDK, at the same
time updating my Eclipse 3.5 with a JavaFX Feature. This feature will
among other things enable you to create a new "JavaFX Project from the
"new Project" menu.
... A Small problem, my bad A
minor setback occurred during my first attempt to create a JavaFX
project from the "new project" menu. I got the error message;”The
JavaFX SDK location was not specified". This is because I am impatient,
and installed the JavaFX plug-in before the JavaFX SDK. If this
happens, it's just a matter of selecting the window/preferences dialog
and select "class path variables" under "build path". There should be a
JAVAFX_HOME class path variable pointing to the directory where the
JavaFX SDK was installed.
And the first project Creating a JavaFX project
is easy. Just select create new project from the menu, and select
"JavaFX Project". After that you can create new Java FX scripts, either
empty, or have some example "hello world" like scripts to start playing
with.
Installing JavaFX plugin for the first time:
- Start
the Eclipse IDE. Specify a path for your Eclipse workspace folder, if
prompted, and close the Welcome screen, if it appears.
- From the main menu of the IDE, choose Help > Software Updates.
-
In the Software Updates and Add-ons dialog box, click the Available
Software tab and Add Site, as shown in the following figure.
Figure 1: Set Up to Add the JavaFX Plugin Update Site URL.
- In the Add Site dialog box, enter
http://javafx.com/downloads/eclipse-plugin/ in the Location text field and click OK, as shown in Figure 2.
Figure 2: Add the JavaFX Plugin Update Site URL.
Figure 3 below shows that the JavaFX Updates site has been added to the list of available software sites.
Figure 3: JavaFX Update Site Added.
- Expand the node for the JavaFX Updates site, select the JavaFX Feature check box, and click Install.
The installer checks for requirements and dependencies prior to installation. This might take some time.
- In
the Install dialog box, review and confirm that the selected JavaFX
Feature item is the correct version to be installed. Click Next.
- Review and accept the terms of the license agreement, if you agree. Click Finish.
The IDE continues with the installation of the JavaFX plugin software.
- Click Yes when prompted to restart the Eclipse Platform.
Updating an existing JavaFX plugin installation:
- Start
the Eclipse IDE. Specify a path for your Eclipse workspace folder, if
prompted, and close the Welcome screen, if it appears.
- Choose Help > Software Updates from the main menu of the IDE.
- In the Installed Software tab, select JavaFX Feature and click Update, as shown in Figure 4.
Figure 4: Update the Current JavaFX Plugin Installation.
- In the Available Updates dialog box, review and confirm the selected update item to be installed and click Finish.
- Click Yes when prompted to restart the Eclipse Platform.
Conclusion I was happy to see that JavaFX works
with the latest eclipse. The only hiccup was a fault of my own. It's
very easy to get started with JavaFX development, probably easier with
Netbeans, as you can download both the IDE and SDK as a bundle. I was
definitely up and running with the platform in under 10 minutes.
References
|