Forums Register Login

Java GUI - what to choose - Swing, JSF, JavaFX, other?

+Pie Number of slices to send: Send
I saw a post by William P O'Sullivan which says that Swing is being replaced by JavaFX and JSF.
Which one is better for GUI in terms of technical superiority and ease of learning ?
2
+Pie Number of slices to send: Send
Swing, JavaFX and JSF are three very different presentation layers.

Swing is a desktop application presentation layer - the GUI for an application running on your computer.

JSF (Jave Server Faces) is a layer for web-applications. You put it on top of JSPs and create a rich web experience using JavaScript to interact with the page. You only use it when your application is on a server, not the desktop. You don't get nearly the 'richness' of a desktop application.

JavaFX is a presentation layer somewhat akin to Flash. It is meant to be embedded in a web page. It is not a desktop application approach. It could be used instead of JApplets, for example, or possibly as an alternative to some applications delivered through Java Web Start.

In short - JSF and JavaFX are not replacements for Swing. You pick the technology for type of application you want to run. If you are considering Swing, then forget about JSF because there is zero overlap. If you are considering Applets then think about JavaFX. If you are thinking desktop, use Swing.

If you are looking to learn one and not the others... then your mind is in the wrong place. Learn one (probably Swing first if you are a new user), then another (probably JavaFX because it will be the easiest transition), and the web applications (Servlets, JSPs, JSF, and EJBs).
+Pie Number of slices to send: Send
I agree with Steve here. From my understanding, JavaFX is one technology that can run on both desktop (like through web start) and embed within web pages (like applets). Yet the functionalities for each technology is something you want to look at depending on exactly what user behavior you want.
+Pie Number of slices to send: Send
 

Andy Jack wrote: Swing is being replaced by JavaFX and JSF.



Don't believe in that rumor! Have you seen anywhere in which Oracle declares that it is replacing Swing by JavaFX and JSF?
2
+Pie Number of slices to send: Send
 

Nam Ha Minh wrote:

Andy Jack wrote: Swing is being replaced by JavaFX and JSF.



Don't believe in that rumor! Have you seen anywhere in which Oracle declares that it is replacing Swing by JavaFX and JSF?



JavaFX replacing Swing

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.
+Pie Number of slices to send: Send
Hi Steve,

Thanks a bunch for the proof. So I need to change now.
+Pie Number of slices to send: Send
I think this thread would fit better in the GUIs forum. Moving.
+Pie Number of slices to send: Send
JSF is obviously not a replacement for Swing.

However, as pointed out above, Oracle recommends development of desktop applications using JavaFX 2.x rather than Swing. It's a different matter that JavaFX can be packaged to run in a web application (like Flash/Applet).
Basically, the idea is to have the same codebase which can run in different devices (Desktop, Browser and maybe mobile devices tomorrow).

Having said that, JavaFX is not yet tightly integrated with Java. Suppose, you develop a Swing application and distribute it, users just need the JRE for the app to run. However, in case of a JavaFX application, users need to install an extra JavaFX plugin for the application to run - note that this is true even for desktop applications.

Last heard, Oracle is planning tight integration of JavaFX with Java from version 8 onwards (so, if user has JRE 8, that would be good enough). So, at a practical level, it will take some more time for people to start using JavaFX for production-ready applications (plus the Mac/Linux versions for JavaFX were also released only recently). So, from a skills perspective, for desktop, Swing will still be used in real projects.
In the meantime, to ease the transition, both JavaFX and Swing support inter-interoperability - for example, Swing provides a JFXPanel with which you can embed JavaFX stuff within a Swing application.

So, I think it would be better to start with Swing and learn the basics - layouts, event handling will be similar in Swing and JavaFX. Nevertheless, if you are only looking at learning to code a desktop application (and not from a sole job perspective), you can start learning JavaFX 2.x.
(1 cow) 1
+Pie Number of slices to send: Send
 

Ranganathan Kaliyur Mannar wrote:JavaFX is not yet tightly integrated with Java. Suppose, you develop a Swing application and distribute it, users just need the JRE for the app to run. However, in case of a JavaFX application, users need to install an extra JavaFX plugin for the application to run - note that this is true even for desktop applications.

Last heard, Oracle is planning tight integration of JavaFX with Java from version 8 onwards


Version 7u6 onwards. From Java SE 7 Update 6 Released:

Java SE 7 Update 6 provides the merging of JavaFX into the Oracle Java SE installation. JavaFX was a stand-alone product, and is now fully integrated in this release. On Windows, JavaFX and Java Access Bridge are now installed as part of the JRE or JDK. This provides convenience for end users and system administrators, who don't need to install and maintain JavaFX separately. Application developers can also be assured that from now on, JavaFX runtime libraries will be present on millions of desktops by default.



From Java SE Downloads:

JavaFX 2.2.4 is now bundled with the JDK on Windows, Mac and Linux x86/x64.

 
+Pie Number of slices to send: Send
 

Darryl Burke wrote:Version 7u6 onwards. From Java SE 7 Update 6 Released:


Cool. Sooner is better.

Darryl Burke wrote:From Java SE Downloads:

JavaFX 2.2.4 is now bundled with the JDK on Windows, Mac and Linux x86/x64.


Cooler!
Thanks for the info!
+Pie Number of slices to send: Send
 

Steve Luke wrote:It is not a desktop application approach.



I agree with everything you said except for this. You can use it for desktop, the web, and soon mobile. Scene Builder is already set up with Zoom, Swipe, and Touch, and they say it will work with sensor detection as well in the future. At the last JavaOne they showed Fx on Mobile.


As to the OP I believe like Steve said, you should do Swing first, and get your feet wet, then goto FX. I have been using swing for a few years and now I am switching everything to FX. FX has so many more capabilities and I cannot wait until it's integrated more with Netbeans and the JDK itself. Check out the road map.

http://www.oracle.com/technetwork/java/javafx/overview/roadmap-1446331.html
It will give me the powers of the gods. Not bad for a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 28150 times.
Similar Threads
Qt Jambi
JavaFX JavaOne buzz - helping or hurting?
xml or code?
Is JavaFX only for internet applications?
Insider's Guide to Mixing Swing and JavaFX
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 03:48:58.