How does the new JavaFX Script language fit with existing Swing and Java2D UI development? An experienced Java UI developer breaks down the good, the bad, and the ugly.

by Jacek Furmankiewicz

Aug 27, 2007

Page 2 of 4

The Good
Many of JavaFX Script's features left me impressed.

Basic Language Features
At the core of JavaFX Script lies its JSON-like syntax for describing user interfaces, which I think is a brilliant design on Chris Oliver's part. Unlike Microsoft's competing XAML, generations of JavaFX Script developers will never have to wrestle with the verbosity of XML to describe user interfaces. Instead they will be able to describe their UIs in a much simpler and more understandable fashion, such as in this example from the JavaFX Script tutorial, which renders the UI in Figure 1:

Powerful High-Level Graphics Capabilities
The previous code is much simpler than the equivalent Swing code. However, this benefit is nothing compared with how productive you become in JavaFX Script when you use its advanced graphic functions. For example, the following code creates the flashy logo seen in Figure 2:

Powerful Databinding
This is the part of JavaFX Script that really impressed me. Databinding to Swing components is not only very easy but also extremely powerful, as it allows for the usage of expressions in the binding logic, for example:

Label {
text: bind "Number of clicks: {model.numClicks}"
}

As you can see, JavaFX Script's high-level dynamic scripting abilities make it potentially a very powerful tool for the hard-core coder.