Max Katz heads Developer Relations for Appery.io, a cloud-based mobile app platform. He loves trying out new and cool REST APIs in mobile apps. Max is the author of two books “Practical RichFaces” (Apress 2008, 2011), and is a frequent speaker at developer conferences. You can find out what Max is up to on his blog: mkblog.exadel.com and Twitter: @maxkatz. Max is a DZone MVB and is not an employee of DZone and has posted 80 posts at DZone. You can read more from them at their website. View Full User Profile

Exadel JavaFX Plug-In for Eclipse Features

04.14.2010
| 10193 views |
  • submit to reddit

If you have been following JavaFX, there are plenty of voices predicting the death (here, and here) of JavaFX as well as some voices predicting its bright (and enterprise-ready) future. For now, I belong to the latter set of voices. And, for me and the company I work for (Exadel), it's not just a matter of opinion, but a matter of commitment through building better tooling support.

Let's look at tooling for JavaFX. Naturally, NetBeans does come with JavaFX support. The support is decent, and there is also work being done on a visual designer for JavaFX. On the Eclipse side, however, there is very little talk or mention of JavaFX tooling.

My company has been developing a JavaFX plug-in Eclipse since last year. Lately we have picked up the pace. First, the plug-is now open source at exadel.org. There is now a public JIRA project for issue tracking, a forum, and nightly builds - all nice integrated together. We have started releasing more frequently (about every two weeks) with bug fixes and a few extra features. We are slowly adding new features, but there is still a lot of work. (Let us know what features you'd like to see in the plug-in's forum.)

Now let's run through the existing features in the plug-in that help you develop JavaFX applications.

Installing

Installing the plug-in is very simple. You can download the plug-in locally and point Eclipse's Install New Software wizard to install from that location. There is also an Eclipse update site. In the Install New Software window, point to this location (http://download.exadel.org/javafx_plugin/updates/stable/) and you will have the plug-in installed in under a minute.

The plug-in works with Eclipse 3.4.2 and 3.5 on Windows, Mac, and Linux.

New Project Creation

Once the plug-in is installed and the JavaFX perspective is selected, there is a wizard to create a new JavaFX project (File/New/JavaFX Project). You will be asked to set the JavaFX SDK. Later, if you need to change the JavaFX SDK entry, you can always do it via Window/Preferences/JavaFX/Installed JavaFX Runtimes.

JavaFX Script Wizard Creator

Once the project is ready, the JavaFX script wizard will help you create your first script by selecting New/JavaFX Script. You will have the option to create a completely empty file or use a number of script generator options shown below:

Stage Generation:

Generating Shapes:

Two more options are available CustomNode and Scene. In these cases, a new JavaFX file will be created either with initial CustomNode or with Scene code.

Projects Based on JavaFX SDK Examples

If you want to see some ready to run examples, then you can create a new JavaFX project based on one of the available JavaFX SDK samples. Select File/New/Examples.../JavaFX Examples/JavaFX Examples and you will get the following wizard:

Running the Application

Once you have created your first page or application, it's time to run it. The plug-in makes it very easy to launch what you have created. Just right-click the file and select Run As. You will get three options: JavaFX Application, JavaFX Application (Applet), and JavaFX Application (Web Start)

Outline View

Selecting any node in the outline, will select it in the JavaFX script editor:

JavaFX Script Editor


Code Assist

When in the JavaFX Script editor, hit Ctrl-Space to get code assist based on your location in the code.

Code Formatting

JavaFX Script has JSON-like format. Formatting the code will make it simpler to understand. To format the code, highlight the section (or the entire page) and select Format.

Before formatting:

After formatting:

Automatic Bracket Closing

Whenever you type an opening { or [ bracket, the appropriate closing bracket will be inserted automatically.

Bracket Matching Indicator

Whenever you put the mouse cursor after a bracket, the closing matching bracket will be highlighed in yellow to help you see where the current block ends.

Resources

Exadel JavaFX plug-in home: http://exadel.org/javafxplugin
Forum: http://exadel.org/forum/javafxplugin
User guide: http://download.exadel.org/javafx_plugin/docs/guide/

Going Forward

We think that JavaFX is a great technology. It's a great language for building user interfaces, and it has a lot of potential, which can be realized if Oracle would invest money in it.

In my opinion, for making JavaFX even greater, one of the most important things Oracle can do is make deployment and launching of JavaFX applications very very simple. It has to be fast, transparent to the end user, with no scary dialog windows appearing. If they need an example of a better way, they can always look at Flash application.

As for the plug-in, it's obviously just a beginning. We would love to hear form you as we add more features.

Published at DZone with permission of Max Katz, 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.)