Java GUI Frameworks - which are out there?

onigunn picture onigunn · Jun 21, 2010 · Viewed 8.7k times · Source

I mainly developing Java EE and now I'm in a situation where I need to write a small native Java app.

But tbh I'm a little bit lost, which frameworks (Swing, SWT, etc.) are out there? Is some rapid dev also possible with one of these? Maybe someone could provide me some links or share his experiences.

Answer

Tomislav Nakic-Alfirevic picture Tomislav Nakic-Alfirevic · Jun 21, 2010

Swing and SWT are the two main candidates, yes. JavaFX also comes to mind, but I think it's not yet ready for prime time: it had no UI editing tool worth speaking of for a long time, the only enterprise UI prototype I know of in real life was a fiasco...

Swing and SWT are the two you might think about. Swing's basic advantages are:

  • more platform independent
  • more consistent in terms of performance
  • better free UI designer (NetBeans)
  • extremely flexible
  • can be used in JavaFX

SWT's advantages are:

  • simpler API
  • uses native UI widgets when it can (the UI is more similar to other apps in the same environment)
  • at some point, it was argued that it's faster than Swing, although this was on Windows only

Quite advanced rich client frameworks exist for both (NetBeans Platform and Eclipse RCP) and if you plan on building anything non-trivial, I would heartily suggest you use one of these: you get modularized apps, update mechanisms, context-sensitive help, consistent actions over menus, hotkeys and toolbars, window management and lots of other excellent features for free.

I worked with Swing and prefer it over SWT as it has a purer component model (with SWT you have to worry about freeing resources, as you're using native widgets), is truly multi-platform (SWT works on Windows, MacOS and Linux, and is not even very well optimized for all three), and it's more customizable.

You're probably not making a mistake trying SWT or even JavaFX, but I'd be hard-pressed to find a good reason to switch to SWT and would try JavaFX only to check the state of the art, assuming the app is just a showcase app.

I could sprinkle a couple of links, but you can easily search for yourself and find the results than interest you.