JavaFX 25, an update of the rich client application platform for Java, has arrived with new capabilities including a preview of JavaFX controls in the title bar, the ability to style RichTextArea
highlights using CSS, the addition of media queries to JavaFX CSS, and the addition of new geometry-based methods to the Text
and TextFlow
APIs.
Notice of the JavaFX 25 release was cited on Oracle’s Inside Java website on September 23, although Gluon was credited with doing most of the work on the project. The release is downloadable from jdk.java.net.
For JavaFX controls in the title bar, which is being previewed in JavaFX 25, a Stage
style is defined in which the client area is extended into the header bar area. This removes the separation between the two regions and allows applications to place scene graph nodes in the header bar area of the Stage
. This new feature provides the default header buttons (iconify, maximize, close), but no system-provided draggable header bar. Applications provide their own header bar by placing a HeaderBar
control in the scene graph, positioned at the top of the window.
Also new in JavaFX 25 is the ability to style RichTextArea
highlights using CSS. JavaFX 25 has added overloads for the following methods that take a list of CSS style names:
RichParagraph::addHighlight
RichParagraph::addWavyUnderline
SimpleViewOnlyStyledModel::highlight
SimpleViewOnlyStyledModel::addWavyUnderline
JavaFX 25 also adds new geometry-based methods toText
and TextFlow
. This was done to provide missing APIs as well as the ability to properly account for insets and padding in TextFlow
. JavaFX 25 also introduces TabStopPolicy
for TextFlow
, which provides a way for applications to define tab stops based on a geometric position in the text line rather than a fixed number of characters. This makes it suitable for proportional and monospaced fonts while boosting support for rich text.
The addition of media queries in JavaFX CSS enables stylesheets to dynamically test specific aspects of the JavaFX scene. Media queries are independent of the contents of the scene graph, its styling, or any other internal aspect. And a new LayoutInfo
object for text layout holds a snapshot of the text layout geometry in a Text
or TextFlow
node. This includes a list of text lines, shapes derived from the layout (selection, underline, strike-through, etc.), and caret information.
Elsewhere with JavaFX 25, it is no longer necessary to pass --sun-misc-unsafe-memory-access=allow
to java
on the command line when running JavaFX applications. The bug that formerly caused this option to be needed has been fixed.
JDK 23 or later is required for JavaFX 25. JavaFX is an open source client application platform for mobile, desktop, and embedded systems built on Java. JavaFX was introduced by Sun Microsystems in May 2007. It became a standalone technology in 2018 after having previously been in the Java Development Kit (JDK).
Release notes for JavaFX 25 can be found on GitHub.