JavaFX 14 is now publicly available for use, updating the cross-platform GUI framework that can expand a single codebase across computers, embedded devices, iOS, and Android.
The release is another milestone in the vibrant post-mortem world since Java allegedly "died" on the desktop. Software engineer Gerrit Grunwald has covered this evolution in a previous talk, "Not dead yet - Java on the desktop." Unlike the postponed James Bond film No Time to Die, Java has "no time to die" because it is widely adopted and growing. Since the un-bundling of JavaFX as a framework outside Oracle Java, a notable community has taken up maintenance with membership from Microsoft, Gluon, Pivotal, and others. JavaFX 14 includes notable enhancements, including support for HTTP/2 in the WebView component. WebView is an embedded web browser component that enables developers to control a browser directly inside of their JavaFX application, for example to mix local Java code with an externally-hosted web application.
One driver for developers selecting the JavaFX framework is the ability to write a single application that can run across Windows, Mac, and Linux, as well as mobile phones and tablets running Android and iOS. The cross-platform capability is provided through an integration between the JavaFX framework and GraalVM. Following compilation, a single application will produce multiple outputs. Unlike the traditional Java JAR files and classpath, GraalVM will produce a single binary output per platform: one for Windows, one for iOS, and so on. When natively-compiled for iOS, the resulting JavaFX application supports current iOS capabilities such as bitcode. Capabilities for Android are similar. Developers of cross-platform applications only need to understand Java and the JavaFX framework, then GraalVM takes care of the compilation phase.
The OpenJFX community features a range of libraries and tools for developers to create applications and focus on business logic of what makes the application unique. A listing of key libraries is available through JavaFX, including existing libraries of UI frameworks like Twitter’s Bootstrap. This functions because JavaFX offers native support for CSS. For Java developers, this library provides an end result similar to what Electron offers to Node developers, except items are native rather than an entire local web browser.
Developers creating JavaFX applications have two choices for development: Java code or FXML. FXML is an XML-based layout that lets designers work on elements separate from code, using a tool like SceneBuilder. Gluon offers a publicly downloadable build of the open-source SceneBuilder tool that can be used standalone or integrated with IDEs like Apache NetBeans.
JavaFX applications also feature runtime diagnostic capabilities. As Java applications, they integrate with well-known performance monitoring tools like OpenJDK Flight Recorder, but UI diagnostic tools exist as well. One tool, Scenic View, offers features to look at a running JavaFX application and navigate its UI layout structure, similar to browser-based DOM inspection tools.
Teams looking to create graphical Java applications for a single device target or across platforms can download JavaFX as a library and use it with any Java distribution, such as AdoptOpenJDK.