BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News JavaFX: One Codebase for Web, PC, and Mobile

JavaFX: One Codebase for Web, PC, and Mobile

This item in japanese

Lire ce contenu en français

Gluon has published a status update for JavaFX, showing the way in which a single JavaFX codebase can be used across a PC (standard JavaFX), a mobile device with Android or iOS (through integrated GraalVM), and a beta of browser-based WebGL (through Gluon).

The new addition of WebGL expands the level of support into the browser client side, enabling developers to write the entire application in a single Java language or codebase, without requiring a specialized JavaScript frontend. The change can benefit developers who write client applications used across multiple device profiles or those who create web frontends that are hosted on web or packaged locally through techniques like Electron.

Pi4J contributor Frank Delporte published a guide and sample project designed to showcase the capability to deliver a single application across Mac and Raspberry Pi devices like the Elecrow CrowPi2 laptop. The project demonstrates how to use common libraries and stylesheets like ControlsFX and BootstrapFX to make JavaFX applications look similar to what users expect. This change can speed up development by using common shared components while retaining a familiar sense of style that applications simply "look different" than what users are used to.

Gluon’s approach delivers a fully client-side component that does not require anything on the server. When built, the JavaFX code is transpiled to JavaScript and then invokes WebGL code. This approach makes JavaFX web frontends accessible to serverless applications because no persistent server-side state is required.

While JavaFX provides the groundwork for cross-platform applications, usage is low across the industry with JavaScript/Web clients far more common. StackOverflow trends reports on similar cross-platform development trends show a relative rise of Flutter and React-native while JavaFX is largely unchanged. When compared against direct numbers, JavaFX has 120,000 students on Udemy compared to React-Native at 900,000 and Flutter at 1,500,000.

JavaFX was recently discussed on the Foojay podcast, with members indicating that the best approach for cross-platform applications is to select a common application style rather than to emulate each platform’s native environment. Developer Gerrit Grunwald pointed out that iOS controls are highly unique with state information commonly outside of the Object represented by the FX control.

Rate this Article

Adoption
Style

BT