Java Reference
In-Depth Information
Chapter 13
JavaFX Languages and Markup
Computer programming is tremendous fun. Like music, it is a skill that derives from an unknown
blend of innate talent and constant practice. Like drawing, it can be shaped to a variety of ends—
commercial, artistic, and pure entertainment. Programmers have a well-deserved reputation for
working long hours, but are rarely credited with being driven by creative fevers. Programmers
talk about software development on weekends, vacations, and over meals not because they lack
imagination, but because their imagination reveals worlds that others cannot see.
—Larry O'Brien and Bruce Eckel
JavaFX provides a rich set of capabilities for building applications that lets you create immersive UIs that go beyond
what you can accomplish with traditional UI toolkits. However, it does not stop there, because JavaFX sits on top of the
Java language, so you can also take full advantage of all the languages and tools that have been developed for the Java
platform. Also, JavaFX comes with FXML, its own UI declaration language written in XML, which is quite powerful in
its own right.
In this chapter we show how you can leverage different languages and markup to create great-looking JavaFX
UIs with less code. The wonderful thing about all the languages and capabilities discussed in this chapter is that it is
your choice. You can continue to build JavaFX applications in pure Java using the imperative style, or you can take
advantage of your favorite JVM language. Who knows? You might even become a convert to one of the languages
discussed in this chapter based on its usage for JavaFX alone.
A Quick Comparison of Alternative Languages
To give you an idea of the power and expressiveness of using different JVM languages, we start out by taking a simple
example and showing it in six different representations. The example is an extension of the Colorful Circles application
designed by Jasper Potts from the JavaFX team. It is a great example of shapes, animation, and effects in a very small
amount of code, and we have adapted it to show binding and interactivity as well. The running Vanishing Circles
application is shown in Figure 13-1 .
 
Search WWH ::




Custom Search