JavaFX vs Swing vs HTML5: Where does JavaFX stand in relation to other UI toolkits?
The fact that JavaFX is more than one of nature’s vagaries was portrayed in our article series “20 JavaFX real-world applications”. However, one question lingers: Where does it stand in relation to other competitive approaches? We asked JAX speaker Manuel Mauky (Saxonia Systems) for a statement.
JAXenter: UI development has entered the next phase with JavaFX. Where would you place it now? Would you recommend it for prolific deployment?
Manuel Mauky: I believe that JavaFX is, with version 8 and subsequent updates, ready for commercial use and is already part of many real-world applications. We have not regretted the decision to involve this technology into the project I am currently working on.
Some points could be improved and other features are still missing; therefore, the specific requirements must always be evaluated before making a recommendation.
JAXenter: How would you rate JavaFX compared to other Java UI toolkits, such as Swing or SWT?
Manuel Mauky: I have briefly worked with Swing and even less with SWT, so I can’t say that my personal experience helps me concoct an accurate comparison. My impression is, nonetheless, that JavaFX makes things easier to implement with less code. In addition to modern features such as declarative UI description through FXML, styling with CSS and simple animations, data binding is a personal highlight, which i.a. enables reactive programming (read also: Einfach und effizient: Reactive Programming mit JavaFX). It’s not as easy with other toolkits, as far as I know.
Future proof is one of the concerns when choosing a toolkit. JavaFX is, through Oracle support, certainly well positioned.
Read also: How JavaFX will outlive HTML5 and co.
JAXenter: Some representatives of the web faction say that Java is not a suitable technology for frontend development – especially in times of HTML5. Adam Bien retaliated in an interview by saying that JavaFX is more stable than HTML5. Who would win in a battle between JavaFX or HTML5?
Manuel Mauky: Actually I can’t really comprehend the fight. Personally, I’m mainly preoccupied with JavaFX, but am also very interested in web trends and like to be inspired – this is how my JAX talk came into being.
HTML5 is certainly a good choice in many cases, but there are and will continue to be circumstances where classic desktop applications make more sense. And for that, JavaFX is surely a good option.
JAXenter: You’re going to introduce the Flux architecture at JAX. What’s that?
Manuel Mauky: The Flux archtecture can be seen as a variant of the MVC pattern. It’s about building and structuring GUI applications.
The central idea is the restriction to unidirectional data flow: data “flows” only from the so-called “Store” to the UI, but not the other way round. User interactions are instead explained through the command pattern. Stores are able to decide for themselves if they want to react to certain commands and change their status, which would result in an UI update.
Read also: 20 JavaFX real-world applications
JAXenter: Flux with JavaFX – how does this work?
Manuel Mauky: With React.js (wherefore Flux was originally developed), conceptually every Store alteration will redraw the whole interface, thus enabling a very easy programming pattern. It’s not so easy in JavaFX. However, we can use data binding and reactive streams to create a similar effect.
JAXenter: Thank you for your insight!