Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should I choose SWT or Swing to program GUI in Java?

I need to create a GUI application in Java. I just realized that I have different optional ways to go (SWT and Swing are among them).

I have already found out that there is a lot of discussions about what way is better and I do not want to go to deep into these discussions (I am a newbie).

I do not care about all aspects of the dilemma. I just have a few main requirements listed bellow:

  1. It should be easy to use (easy to create what I want).
  2. In the end I would like to have just one file which can be easily executed (without any additional tricks, settings and installations) like a standalone application.
  3. It should be platform independent. Or more specifically, the application should work fine on Microsoft-Windows and Ubuntu (Linux).
like image 809
Roman Avatar asked Feb 17 '10 13:02

Roman


2 Answers

Based on your requirements, I would say Swing. SWT has a more platform-specific look about it but Java ships with Swing built-in, there's no messing about with external libraries as with SWT although the use of Eclipse may make that much easier (I still develop quite a bit of my stuff from the command line unfortunately).

They're both easy in terms of use (well, easy once you get used to layout managers) and will work fine under both your desired platforms but since the only differentiator you seem to care about is the "without any additional tricks, settings and installations", I would stick with Swing.

That's my advice. Feel free to accept or ignore or even call me an old coot. I won't take offence :-)

like image 154
paxdiablo Avatar answered Sep 23 '22 21:09

paxdiablo


I just completed a two year project creating a buisiness application, so my focus was clearly on usability and speed.

My decision in the end clearly led to SWT, for the following reasons:

  • Buisiness users tend to use Terminal Servers and RDP for their apps. Every Swing app is very slow over RDP, because the app has to render every pixel again and again. Try using Photoshop or Gimp over RDP and start scrolling in an image. That is the performance you have with Swing in tables.
  • Some very good gui components are only available as COM objects. I wanted to be able to use those, and since 100% of all buisiness customers are Windows users, they accept the fact that your software only runs on Windows. (We have linux clients, too, but only for machine input terminals, that don't need the full blown Windows GUIs)
  • We use SWTDesigner as a GUI designer, which is as good as SwingDesigner für Swing (which both are the best GUI designers at all). They are worth the price tag if you have to create a few hundred masks.
  • Our GUI looks 100% native, honors the large fonts they use on their desktops, and feels fast.

We are very satisfied with SWT, but it has some downsides:

  • Native Java components are a bit rare. There is more on the Swing side of life.
like image 32
Daniel Avatar answered Sep 21 '22 21:09

Daniel