Converting Swing application to JavaFX


What are the necessary steps for converting a Swing application into JavaFX?

It would also be interesting to know about the best practices when performing this task (i.e. problems that can be encountered and resolutions).

11/9/2017 1:58:59 AM

Accepted Answer

I don't know if there are "best" practices there, as JavaFX is quite new and people are more busy making new JavaFX programs than converting old Java ones...

First, I would ask why you want/need to do that... Second, I would say it depends on the purpose and complexity of the Swing program. If that's a plain dialog, it shouldn't be hard. If it is a complex application with sub-panels, lot of pop-up dialogs, menus, MDI behavior with docking, etc., it might be hard to impossible to port...

Somehow, it might be better to rewrite the GUI from scratch, knowing that you have to either use a wrapper of Swing components in JavaFX, or limit yourself to the (currently) limited range of native JavaFX components.

Now, if your application was written with good principles, you can rewrite only the view and controller parts, and re-use (most of) the models / business logic as JavaFX can very well exploit Java classes.

6/11/2009 11:22:51 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow