Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I keep using Swing for my desktop application [closed]

I am currently working on an application with a code base that dates back to at least 2001. One of the components of this system is a desktop client that is written using Java Swing. It uses most of the good old layouts including BorderLayout, FlowLayout, and Gridbag layout. There are a number of fairly complex screens we need to manage and update periodically and we sometimes need to create new features with new user interfaces.

Is there something better than Swing we could look into migrating to?

Would it be possible to do this migration in stages (i.e. we would have a mix of the old Swing components with the new components during a prolonged migration phase)?

If we were to re-write the desktop client in Java today should we still use Swing?

I find myself using primarily GridBagLayout, is this still the tool of choice for more complex layouts or are there better layouts I could be using?

like image 698
John Avatar asked Feb 07 '23 12:02

John


2 Answers

I was reading in book that Oracle intend to replace Swing by JavaFX.

Take a look in the question and answer bellow:

6. Is JavaFX replacing Swing as the new client UI library for Java SE? Yes. However, Swing will remain part of the Java SE specification for the foreseeable future, and therefore included in the JRE. While we recommend developers to leverage JavaFX APIs as much as possible when building new applications, it is possible to extend a Swing application with JavaFX, allowing for a smoother transition.

You can see there original comment here.

In this case, I believe that you can consider to user JavaFX.

More details here and good examples here.

like image 100
josivan Avatar answered Feb 13 '23 23:02

josivan


If you are using Java 8 you can use javafx for new componant. It's possible to use Swing componant with javafx.

like image 29
JEY Avatar answered Feb 14 '23 00:02

JEY