Book Image

JavaFX Essentials

By : Mohamed Taman, Mohamed Taman
Book Image

JavaFX Essentials

By: Mohamed Taman, Mohamed Taman

Overview of this book

Table of Contents (16 chapters)
JavaFX Essentials
About the Author
About the Reviewers
Monitoring and Controlling Arduino with JavaFX

JavaFX features

The following features are included in JavaFX 8 and later releases as per JavaFX's official documentation:

  • Java APIs: JavaFX is a Java library that consists of classes and interfaces that are written in Java code.

  • FXML and Scene Builder: This is an XML-based declarative markup language for constructing a JavaFX application user interface. You can code in FXML or use JavaFX Scene Builder to interactively design the GUI. Scene Builder generates FXML markup that can be ported to an IDE like NetBeans, where you can add the business logic. Moreover, the FXML file that is generated can be used directly inside the JavaFX application.

  • WebView: This is a web component that uses WebKit, an HTML render engine technology, to make it possible to embed web pages within a JavaFX application. JavaScript running in WebView can call Java APIs and vice-versa.

  • Swing/SWT interoperability: The existing Swing and SWT applications can benefit from JavaFX features such as rich graphics, media playback, and embedded web content.

  • Built-in UI controls and CSS: JavaFX provides all the major UI controls, and some extra uncommon controls like charts, pagination, and accordion that are required to develop a full-featured application. Components can be skinned with standard web technologies such as CSS.

  • 3D graphics features: Support for the 3D graphics library is included.

  • Canvas API: You can draw directly inside a JavaFX scene area using the Canvas API, which consists of one graphical element (node).

  • Multitouch support: Multitouch operations are supported based on the capabilities of the underlying platform.

  • Hardware-accelerated graphics pipeline: JavaFX graphics are based on the graphics-rendering pipeline, Prism. The Prism engine smoothly and quickly renders JavaFX graphics when used with a supported graphics card or graphics processing unit (GPU). If a system does not feature one of them, then Prism defaults to the software-rendering stack.

  • High-performance media engine: This engine provides a stable, low-latency media framework that is based on the GStreamer multimedia framework. The playback of web multimedia content is supported with the media pipeline.

  • Self-contained deployment model: Self-contained application packages have all of the application resources and a private copy of the Java and JavaFX runtimes. They are distributed as native installable packages and provide the same installation and launch experience as native applications for that operating system.

What's new in JavaFX 8

The following is a brief summary of the new features and significant product changes made in the JavaFX component of the Java SE 8 release:

  • The new Modena theme is now the default theme for JavaFX applications.

  • Support for additional HTML5 features, including Web Sockets, Web Workers, Web Fonts, and printing capabilities have been added.

  • The API enables you to embed Swing content into JavaFX applications with the new SwingNode class, which improves the Swing interoperability feature.

  • DatePicker, Spinner, and TableView built-in UI controls are now available.

  • It provides the public JavaFX printing APIs through the javafx.print package.

  • Support for Hi-DPI displays has been made available.

  • CSS-styleable classes became public APIs.

  • A scheduled service class has been introduced.

  • The 3D graphics library has been enhanced with several new API classes.

  • Major updates have been added to the Camera API class in this release.

  • Now JavaFX 8 supports rich text capabilities. These include bidirectional and complex text scripts such as Thai and Hindi in UI controls, and multiline, multistyle text in text nodes.

  • Dialogs and accessibility APIs are supported.

In Appendix, Become a JavaFX Guru, I have provided a list of all the references (links, books, magazines, articles, blogs, and tools) and real JavaFX 8 production applications you will need to become a JavaFX guru.

The following figure shows the Ensemble8.jar application built using JavaFX 8, showing examples dealing with various JavaFX 8 components, topics and concepts. More interestingly, the source code is available to learn from and modify – consult the last chapter to see how to install this application.

JavaFX 8 applications

There are many topics covered by the application, especially the new JavaFX 8 3D APIs, which can be found under the Graphics 3D section as seen in the following figure:

JavaFX 8 3D applications