|Written by Nikos Vaggalis|
|Thursday, 15 December 2022|
WebFX offers a new way to develop modern web-based Java applications with rich desktop-like GUIs. How is that possible?
That means that if you are responsible for a legacy JavaFX application or are developing under the revamped JavaFX as Openjfx you can now port your application to the web without having to rewrite it.
Of course, that's due the magic of the transpiler. We have explored that notion in "A Compiler Writing Playground"
So you can convert applications and languages that sound like misfits, to each other.
At WebFX's core lies the WebFX kit which is a modified version of OpenJFX that can be transpiled. This is achieved by patching the higher layer of OpenJFX (which contains the main JavaFX features and API) to make it GWT compatible, and by replacing the lower layer (the graphic rendering pipeline) by a scene graph DOM mapper (the DOM being finally rendered by the browser).
WebFX does not require the presence of a server however and that is one of its biggest advantages;a standard self-contained JS packaging is a much more simple, scalable and reliable execution model.
Its other advantage is that it is multi-platfrom. In addition to the web platform, a WebFX application can also run on desktops & mobiles with Gluon toolchains to produce native executables.
This ability to create applications for different platforms starkly reminded me of Jetpack Compose Multiplatform, an extension to the Jetpack Compose UI framework from JetBrains, which makes it possible to build Android, Desktop, and Web UIs with the same artifacts from a single codebase. It works on top of Kotlin Multiplatform, the SDK for cross-platform development provided by JetBrains, which is the technology the supports the code sharing.
However in order to producer native executables with WebFx you need Gluon and in extension GraalVM too. When using the GluonFX plugins (for Maven and Gradle) in a JavaFX application, developers are leveraging Gluon Substrate which provides the way to create native images for Java and JavaFX projects that can target all platforms (desktop, mobile and embedded). Under the hood, Gluon Substrate leverages the GraalVM project.
Since the project is still in the incubation phase, there are some limitations;limited JavaFX coverage, bugs in WebFX, GWT compilation errors etc. But despite the limitations, you can already develop real applications. The project's website for example has been developed using WebFX, presenting the technology through a series of animated cards.
Third party apps are shingly making their appearance too. For instance 'Modality' a free, open-source, hospitality-oriented booking system Powered by WebFX but with a server backend;Vert. x to interface between client apps and back-end services, serving the SPA.
WebFX is, of course, open source. As such on its Github repo you can find all the relevant code plus the code of the demos, to get a head start.
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
or email your comment to: firstname.lastname@example.org
|Last Updated ( Thursday, 15 December 2022 )|