JavaFX. The latest flagship of Oracle is JavaFX and is counted at top among the Best Java GUI frameworks. JavaFX is the latest toolkit of Java/Oracle replacing Swing to create rich desktop as well as web applications. Many new Java GUI programs are being developed using JavaFX.
From a Java developer perspective, both technologies are highly useful in writing pluggable UI components. With its vast UI component library, Swing can provide added advantage to the developer, whereas when it comes to design modern and rich internet application, JavaFX can supersede Swing.
Java AWT has comparatively less functionality as compared to Swing. Java Swing has more functionality as compared to AWT. 4. The execution time of AWT is more than Swing.
In short, Swing and JavaFX are both GUI toolkits for Java programs. Swing is the old standard toolkit that features a bigger library of GUI elements and mature IDE support. JavaFX is the newer standard with a smaller library, more consistent updates, and consistent MVC support.
Decision tree:
Frameworks like Qt and SWT need native DLLs. So you have to ask yourself: Are all necessary platforms supported? Can you package the native DLLs with your app?
See here, how to do this for SWT.
If you have a choice here, you should prefer Qt over SWT. Qt has been developed by people who understand UI and the desktop while SWT has been developed out of necessity to make Eclipse faster. It's more a performance patch for Java 1.4 than a UI framework. Without JFace, you're missing many major UI components or very important features of UI components (like filtering on tables).
If SWT is missing a feature that you need, the framework is somewhat hostile to extending it. For example, you can't extend any class in it (the classes aren't final, they just throw exceptions when the package of this.getClass()
isn't org.eclipse.swt
and you can't add new classes in that package because it's signed).
If you need a native, pure Java solution, that leaves you with the rest. Let's start with AWT, Swing, SwingX - the Swing way.
AWT is outdated. Swing is outdated (maybe less so but not much work has been done on Swing for the past 10 years). You could argue that Swing was good to begin with but we all know that code rots. And that's especially true for UIs today.
That leaves you with SwingX. After a longer period of slow progress, development has picked up again. The major drawback with Swing is that it hangs on to some old ideas which very kind of bleeding edge 15 years ago but which feel "clumsy" today. For example, the table views do support filtering and sorting but you still have to configure this. You'll have to write a lot of boiler plate code just to get a decent UI that feels modern.
Another weak area is theming. As of today, there are a lot of themes around. See here for a top 10. But some are slow, some are buggy, some are incomplete. I hate it when I write a UI and users complain that something doesn't work for them because they selected an odd theme.
JGoodies is another layer on top of Swing, like SwingX. It tries to make Swing more pleasant to use. The web site looks great. Let's have a look at the tutorial ... hm ... still searching ... hang on. It seems that there is no documentation on the web site at all. Google to the rescue. Nope, no useful tutorials at all.
I'm not feeling confident with a UI framework that tries so hard to hide the documentation from potential new fans. That doesn't mean JGoodies is bad; I just couldn't find anything good to say about it but that it looks nice.
JavaFX. Great, stylish. Support is there but I feel it's more of a shiny toy than a serious UI framework. This feeling roots in the lack of complex UI components like tree tables. There is a webkit-based component to display HTML.
When it was introduced, my first thought was "five years too late." If your aim is a nice app for phones or web sites, good. If your aim is professional desktop application, make sure it delivers what you need.
Pivot. First time I heard about it. It's basically a new UI framework based on Java2D. So I gave it a try yesterday. No Swing, just tiny bit of AWT (new Font(...)
).
My first impression was a nice one. There is an extensive documentation that helps you getting started. Most of the examples come with live demos (Note: You must have Java enabled in your web browser; this is a security risk) in the web page, so you can see the code and the resulting application side by side.
In my experience, more effort goes into code than into documentation. By looking at the Pivot docs, a lot of effort must have went into the code. Note that there is currently a bug which prevents some of the examples to work (PIVOT-858) in your browser.
My second impression of Pivot is that it's easy to use. When I ran into a problem, I could usually solve it quickly by looking at an example. I'm missing a reference of all the styles which each component supports, though.
As with JavaFX, it's missing some higher level components like a tree table component (PIVOT-306). I didn't try lazy loading with the table view. My impression is that if the underlying model uses lazy loading, then that's enough.
Promising. If you can, give it a try.
SWT by itself is pretty low-level, and it uses the platform's native widgets through JNI. It is not related to Swing and AWT at all. The Eclipse IDE and all Eclipse-based Rich Client Applications, like the Vuze BitTorrent client, are built using SWT. Also, if you are developing Eclipse plugins, you will typically use SWT.
I have been developing Eclipse-based applications and plugins for almost 5 years now, so I'm clearly biased. However, I also have extensive experience in working with SWT and the JFace UI toolkit, which is built on top of it. I have found JFace to be very rich and powerful; in some cases it might even be the main reason for choosing SWT. It enables you to whip up a working UI quite quickly, as long as it is IDE-like (with tables, trees, native controls, etc). Of course you can integrate your custom controls as well, but that takes some extra effort.
I would like to suggest another framework: Apache Pivot http://pivot.apache.org/.
I tried it briefly and was impressed by what it can offer as an RIA (Rich Internet Application) framework ala Flash.
It renders UI using Java2D, thus minimizing the impact of (IMO, bloated) legacies of Swing and AWT.
Swing + SwingX + Miglayout is my combination of choice. Miglayout is so much simpler than Swings perceived 200 different layout managers and much more powerful. Also, it provides you with the ability to "debug" your layouts, which is especially handy when creating complex layouts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With