The Future of Java FX

Monday, March 18, 2019

Who still remembers the early days of JavaFX? Introduced in 2008, a time when Swing was treated like a red-headed stepchild, Java was “sloooow”, and falling behind on other Rich internet Applications (RIA) frameworks like Silverlight and Adobe Flex. So Sun introduced a successor: a new technology called JavaFX Script. Take a look at the following snippet:

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
 
Stage {
    title: "Hello World"
    width: 250
    height: 80
    scene: Scene {
        content: Text {
            font : Font {
                size : 24
            }
            x: 10, y: 30
            content: "Hello World"
        }
    } 
}

…needless to say, it wasn’t very well received. The learning curve was too high, syntax was clumsy and difficult to read, there’s no separation of logic and UI, among many other problems. So it seemed like Java on desktop & beyond wasn’t going to happen soon.

A new world 

Fast forward to 2010; FX Script has been open-sourced to Visage, Oracle acquired Sun Microsystems and a whole re-write of JavaFX Script resulted in JavaFX 2.0. Many people (including me) felt like what it should’ve been from the start. Its own component library, CSS styling, no ugly scripting & syntax. Simple, pure Java as we know it. Unfortunately, no DI framework support just yet… We’ll have to wait another 2 years for that.

Overall quite nice, so why didn’t it gain momentum? Well, web 2.0 happened, and many questions were raised: is there still a future for desktop applications? How about FX on mobile? Tooling support? The fact that other RIA’s such as Silverlight and Flex were dwindling didn’t help either. Java on desktop & beyond still wasn’t happening.

FX is...removed? 

Yes. In JDK 11, you’ll no longer find the FX runtime jars included. They’re available only as a separate download. So that’s it, than? It’s all over for FX?

Not really. The decoupling of FX was planned since the introduction of the modular system in JDK 9. This will clear the way for new contributors to engage in the open source OpenJFX community. Meanwhile, Oracle still provides commercial support for FX in JDK 8 through at least 2022.

FX has been through a lot over the years, but it always survived. There’s still a huge community working on / with FX (Gluon, JFoenix…) which resulted in some nifty frameworks like: ControlsFX, Afterburner, DataFX, Scenic View and many others. Those are still actively maintained today.

In the long run, FX’s future will depend more on community and open source efforts - primarily through OpenJDK / OpenJFX - which has big, fat companies like Red Hat and IBM as contributors.

Knowing how passionate, diverse and highly motivated the open source community can be, maybe this will be the year where it’s finally going to happen ?

 

Sources:

OpenJFX

Oracle's view on FX

Gluon HQ

Adopt OpenJDK