Java Reference
In-Depth Information
Chapter 1
Getting a Jump Start in JavaFX
Don't ask what the world needs. Ask what makes you come alive, and go do it. Because what the
world needs is people who have come alive.
—Howard Thurman
At the annual JavaOne conference in May 2007, Sun Microsystems announced a new product family named JavaFX.
Its stated purpose includes enabling the development and deployment of content-rich applications on consumer
devices such as cell phones, televisions, in-dash car systems, and browsers. Josh Marinacci, a software engineer
at Sun, made the following statement, very appropriately, in a Java Posse interview: “JavaFX is sort of a code word
for reinventing client Java and fixing the sins of the past.” He was referring to the fact that Java Swing and Java 2D
have lots of capability, but are also very complex. By using FXML, JavaFX allows us to simply and elegantly express
user interfaces (UIs) with a declarative programming style. It also leverages the full power of Java, because you can
instantiate and use the millions of Java classes that exist today. Add features such as binding the UI to properties in a
model and change listeners that reduce the need for setter methods, and you have a combination that will help restore
Java to the client-side Internet applications.
In this chapter, we give you a jump start in developing JavaFX applications. After bringing you up to date on the
brief history of JavaFX, we show you how to get the required tools. We also explore some great JavaFX resources and
walk you through the process of compiling and running JavaFX applications. In the process you'll learn a lot about the
JavaFX application programming interface (API) as we walk through application code together.
A Brief History of JavaFX
JavaFX started life as the brainchild of Chris Oliver when he worked for a company named SeeBeyond. They had
a need for richer user interfaces, so Chris created a language that he dubbed F3 (Form Follows Function) for that
purpose. In the article “Mind-Bendingly Cool Innovation” (cited in the Resources section at the end of this chapter),
Chris is quoted as follows: “When it comes to integrating people into business processes, you need graphical user
interfaces for them to interact with, so there was a use case for graphics in the enterprise application space, and there
was an interest at SeeBeyond in having richer user interfaces.”
SeeBeyond was acquired by Sun, who subsequently changed the name of F3 to JavaFX, and announced it at
JavaOne 2007. Chris Oliver joined Sun during the acquisition and continued to lead the development of JavaFX.
The first version of JavaFX Script was an interpreted language, and was considered a prototype of the compiled
JavaFX Script language that was to come later. Interpreted JavaFX Script was very robust, and there were two JavaFX
topics published in the latter part of 2007 based on that version. One was written in Japanese, and the other was
written in English and published by Apress ( JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-Side
Applications, Apress, 2007).
While developers were experimenting with JavaFX and providing feedback for improvement, the JavaFX
Script compiler team at Sun was busy creating a compiled version of the language. This included a new set of
runtime API libraries. The JavaFX Script compiler project reached a tipping point in early December 2007, which
 
Search WWH ::




Custom Search