Watch Introducing
JavaFX 2.0
ecosystem in terms of third-party libraries
around. Being able to leverage that kind of
support for developing client applications is
a big plus.
Java Magazine: Can languages like JRuby,
Scala, and Groovy interoperate with
JavaFX 2.0?
Ramani: Absolutely. Just as you can run any of
these languages on top of the Java platform,
they also all interoperate with JavaFX 2.0. In
fact, there’s a project in the Groovy community called GroovyFX, which uses the Builder
design pattern for JavaFX applications. Most
of this work is being done open source, and
many of the language implementers are
excited about using JavaFX 2.0 technology.
For some Java developers, dynamic scripting
languages are a vital part of their toolkit, and
JavaFX can seamlessly work with them.
Because JavaFX uses familiar design patterns, such as POJOs following the JavaBeans
naming conventions, many of these languages
already have enhanced support for JavaFX
right out of the gate. In addition, JavaFX was
carefully designed with consistent API idioms,
such as event handling, which make it easy for
other languages to provide syntactic sugar for
these APIs.
Java Magazine: Will you describe an application scenario where Prism, the hardware
accelerated graphics pipeline, and the new
Glass windowing toolkit might offer tangible
advantages?
Ramani: Prism handles rasterization and
rendering of JavaFX scenes. It can execute on
both hardware and software renderers. The
Glass windowing toolkit is the lowest-level
framework for the JavaFX 2.0 graphics stack—
it manages timers, surfaces, and windows.
When developers need gradients and
shading, or any sort of advanced graphics,
hardware acceleration can offer a huge payoff
in system responsiveness. And when ap-
plications need to build tables and display
large data sets, Prism can also be valuable.
The Prism/Glass combination eliminates the
need to instantiate and load Swing and AWT
classes, which gives JavaFX 2.0 a definite
performance advantage.
Java Magazine: How will FXML, the JavaFX 2.0
XML-based markup language, add value for
developers? And will you describe how Scene
Builder will be useful for generating FXML?
Ramani: The fact that FXML is XML-based
is a huge advantage from a tools perspec-
tive, because Java IDEs such as NetBeans and
Eclipse interoperate easily with XML. Layout
design for enterprise applications is one of the
trickiest and most-labor-intensive endeavors.
The visual JavaFX Scene Builder tool mitigates
the need for hand coding, which is a definite
productivity bonus. Also, FXML ties
into JavaFX Scene Builder in two
ways: developers can either pro-
grammatically make changes and
then generate FXML, or they can
use JavaFX Scene Builder to design
the JavaFX UI components and
then save them as FXML markup.
JavaScript can also be seamlessly
integrated into this scenario. So
there’s a great deal of flexibility.
These tools also allow the use of
CSS. Once an application is created,
a completely new visual look can be
generated without recompilation
by changing either the style sheet
or the FXML code. This is an indus-
try trend, and JavaFX 2.0 provides
the toolset.
Java Magazine: Is HTML5 part of the JavaFX
2.0 landscape?
Ramani: HTML5 technologies are still under
development by the W3C. But support for
HTML5, as defined today, is built into JavaFX
2.0. Our Web component is based on WebKit,
which supports HTML5. Many developers are
already using WebKit-based browsers. Possible future developments, like offline storage,
Web SQL databases, native drag-and-drop,
and geolocation, will be of interest as they
evolve. We plan to stay in sync with HTML5.
Java Magazine: How do the JavaFX UI control
libraries fit into the JavaFX 2.0 toolset?
Ramani: I was a longtime Swing developer
myself, and I love its capabilities—a great way
to program. But every component in Swing
tends toward rectangular forms. Today, we
need more flexibility. JavaFX 2.0 UI controls
offer the ability to create rounded shapes,
a much wider range of components, and
COMMUNITY
JAVA IN ACTION
COMMUNITY COMMENT
“Making JavaFX open source
is a huge step in the right
direction for this technology. It
will enable businesses to use
JavaFX with no fear about
vendor lockin, and let the community participate
and grow the platform in new and innovative
ways. I have been advocating for this move since
the 1.0 release, and am glad that Oracle listened
to the community and made this possible.”
—Stephen Chin, a technical expert in RIA technologies and
chief agile methodologist at GXS
ABOUT US
blog
PHOTOGRAPH BY HARTMANN STUDIOS