RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


JavaFX 2.0: A Platform for Rich Enterprise Client Apps

The update to JavaFX allows developers to leverage features from the Java API.


JavaFX 2.0 revamped the Java API for application development, discarding its predecessor's clumsy scripting language. This enhancement has captured the attention of developers to rethink JavaFX 2.0 as a platform for creating and deploying rich client applications. Developers can now leverage their existing Java skills without worrying about spaghetti scripting code. JavaFX 2 can run either as a standalone desktop application or in the browser. The architecture is extensible with existing Swing or the SWT API.

JavaFX 2.0 is a rich client platform designed to provide an environment that not only minimizes development time but also eases the deployment of data-driven business and enterprise client applications.

JavaFX 2.0 Architectural Overview

JavaFX 2.0 is comprised of several subcomponents, including a high-performance graphics engine named Prism. Prism is the byproduct of a Mozilla Labs experiments to bridge the gap in user experience between Web applications and desktop apps. JavaFX also includes the Glass window toolkit, a media engine and a Web engine.

  • The JavaFX public API provides freedom and flexibility in creating rich client applications. Since JavaFX 2 includes the capabilities of the Java platform, it can leverage the power of Java features such as annotations, multi-threading, generics, and the extended Java collection library. Most of the API and programming model have been ported directly as a lineage of its predecessor, while some APIs such as Layout and Media have been optimized and simplified in response to the feedback from previous FX users.

  • Scene graph is the starting point of JavaFX 2.0 application. It is responsible for rendering user interfaces and handling user input through various visual elements represented as hierarchical tree of nodes. Each item in the scene graph is called a node and has one parent and zero or more children. The javafx.scene API simplifies working with rich UIs.

  • The Quantum Toolkit connects Prism and Glass Windowing Toolkit together to make them available to the JavaFX layer above them in the stack and also manages the threading rules related to rendering versus events handling.

  • Prism is responsible for rasterization and rendering of JavaFX scenes and processes rendering jobs. It can run on both hardware and software renderers, including 3-D.

  • Glass Windowing Toolkit's main responsibility is to provide native operating services, such as managing the windows, timers and surfaces. It serves as the platform-dependent layer that connects the JavaFX platform to the native operating system. The Glass toolkit is also responsible for managing the event queue.

  • The Media Engine component has been completely redesigned for JavaFX 2.0 to increase stability, improve performance and provide consistent behavior across platforms.

  • Web Engine component is based on Web Kit, an open source Web browser engine that supports HTML5, CSS, JavaScript, DOM and SVG. It enables developers to implement features such as rendering HTML content, support history, back and forward navigation, execute JavaScript command and event handling in their Java applications.

JavaFX 2.0 Key Features

  • JavaFX APIs: Many API features are carried over from the Java language, such as use of generics, annotations, multi-threading and collections classes. Collections are defined by the javafx.collections package consisting of the following interfaces and classes:
    • JavaFX Interfaces
      • ObservableList: It is a list that enables listeners to track changes at the time of occurrence

      • ListChangeListener: It is an interface that receives notifications of changes to an ObservableList

      • ObservableMap: It is a map that enables observers to track changes when they occur

      • MapChangeListener: It is an interface that receives notifications of changes to an ObservableMap

    • JavaFX Classes
      • FXCollections: It is an utility class consists of static methods that are mapped copies of java.util.Collections methods

      • ListChangeListener.Change: It represents a change made to an ObservableList

      • MapChangeListener.Change: It represents a change made to an ObservableMap

    The close integration between JavaFX and the Java API has enabled developers to leverage sophisticated Java IDEs, debuggers and profilers in building rich client applications.

  • FXML: FXML is a scriptable, XML-based markup language that provides the structure for building a user interface separate from the application logic. This separation of the presentation and application logic will particularly enrich Web developers in building rich client apps because they can assemble a user interface that leverages Java components without mastering the code for fetching and filling in the data. However, it can also be used as an alternative for developing user interfaces programmatically in Java. This scripting feature allows embedding scripts within a FXML file. Any JVM scripting language such as JavaScript, Groovy or Clojure can be used to access FXML script for the purpose.

  • Graphics Pipeline for Modern GPUs: It is convenient to build rich graphics with support for high-level APIs, such as blurs, shadows, 2D /3D transformation, effects, charts and reflections. The windowing toolkit gets hardware accelerated graphics pipeline support from Prism. And for unsupported graphics hardware, there is also provision for support by the Java 2D software pipeline. The animation engine is optimized to implement transitions with complete overhaul of the API to simplify usage.

  • Set of Rich UI Controls: There are more than 50 components for form-based UI, including charts, layout and form controls. User Interface Controls are specialized Nodes in the JavaFX Scene graph suited for reuse in many different application contexts. Cascading Style Sheet (CSS) can be used effectively to design the look and feel and layout of user interface controls. The JavaFX UI controls available through the API are built by using nodes in the scene graph. Thus the controls can use visually rich features of the JavaFX platform. As the JavaFX APIs is fully implemented in Java, it is easy to integrate the JavaFX UI controls into existing Java applications.

  • Web Component: JavaFX 20 introduced the embedded browser, which provides not only a Web viewer but also full browsing functionality through its API. The embedded browser component is based on WebKit, an open source Web browser engine. It supports Cascading Style Sheets (CSS), JavaScript, Document Object Model (DOM), and some features of HTML5, including rendering canvas and timed media playback. The embedded browser enables developers to perform the following tasks in their applications:
    • Render HTML content from local and remote URLs

    • Execute JavaScript commands

    • Access document model from Java code

    • Handle events

    • Manage web pop-up windows

    • Apply effects to the embedded browser

    Web content can be embedded in JavaFX applications. Integration of WebKit has made HTML and JavaScript rendering fluid, in addition to providing DOM access and manipulation from Java.

  • Powerful Properties Model: JavaFX 2.0 also introduced a new set of collections, such ObservableList, Sequence and ObservableMap, which can be used effectively in cooperation with the existing Collection classes of Java. In addition, introduced new design and implementation of bean properties and a low-level binding API for high performance lowering footprint bindings.

Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date