JavaFX vs SWT? (Pros and Cons)
Asked Answered
F

3

10

I am confused and don't know which to select: SWT/JFace or JavaFX. Which one is better? I know that SWT is native, but is JavaFX native or not? Is it important to use native UI, or is JavaFX the best choice?

Freed answered 8/11, 2011 at 8:0 Comment(1)
I would really be interested in the answer to this same question as of December 2013, what with JavaFX 8 being given a lot of press.Patnode
N
5

That choice really depends on so many other things than the UI toolkits themselves. After all, you can implement almost the same look-n-feel with all the established UI toolkits - the APIs might be very, very different - but the results are not...

It is the environments that surrounds the toolkits that are important.

First and foremost, the main difference between SWT/JFace on one side and Swing or JavaFX on the other side, is the presence of the Eclipse application framework with the workbench and the associated services. And of cause OSGi... For me, that has made a big difference. Swing and JavaFX have something similar in the Java framework, but not nearly as developed.. in my view.

Nimbostratus answered 19/11, 2011 at 20:50 Comment(4)
"The results are not" I disagree strongly. Native look and feels are VERY different than true native controls (best example in my mind is the File dialog that each offers)Nagana
Now a days, I would say that there are very, very few differences. Even the File dialog is the same in Swing and JavaFX - AFAIK...Nimbostratus
I'm definitely a native fanboy. I just know that for awhile, the File dialog on Windows was missing icons for Swing, and that leaves a bad taste in my mouth as I'm trying to design professional UIs. Thanks for your response.Nagana
Actually, for the specific File dialog example, JavaFX uses the native File dialog from the OS (e.g. a Windows file chooser on Windows and an OS X file chooser on OS X). This is unlike Swing, as far as I know which renders file dialogs as Swing components and so looks exactly the same across different platforms (but also different from the standard native file dialogs on each platform).Maure
U
3

Oracle has stated that JavaFX 2.0 is the replacement for Swing. I would go with JavaFX for a new GUI client for windows.

Unpen answered 10/11, 2011 at 21:40 Comment(3)
I won't necessarily downvote this, but you shouldn't go with a technology just because oracle says so.Plasm
Downvoted just because the OP doesn't write about Swing, but SWT instead, and this is the most voted answer.Azobenzene
Swing will live in a similar fashion COBOL applications live. Complex GUI systems are not easy to port to JavaFX and people (me including) will continue using Swing. Sure for new projects JavaFX is recommended, but JavaFX may not be the best choice if everything else is SWING...Alfonse
T
1

This paragraph would help you what to choose. Because I read this from Java The Complete Reference Ninth Edition Book:

One question that naturally arises relating to JavaFX is this: Is JavaFX designed as a replacement for Swing? The answer is a qualified Yes. However, given the large amount of Swing legacy code and the legions of programmers who know how to program for Swing, Swing will be in use for a very long time. This is especially true for enterprise applications.Nevertheless, JavaFX has clearly been positioned as the platform of the future. It is expected that, over the next few years, JavaFX will supplant Swing for new projects. JavaFX is something that no Java programmer can afford to ignore.

Thereabout answered 22/1, 2018 at 17:40 Comment(1)
Fine, except for the last sentence "JavaFX is something that no Java programmer can afford to ignore." => If you don't plan on creating GUIs with a Java Toolkit, then you really could completely afford to ignore JavaFX if you wished (and most Java programmers that I know that only write server code do so).Maure

© 2022 - 2024 — McMap. All rights reserved.