Switching to SWT: what are the disadvantages?

We plan to migrate our Swing applications to SWT / JFace to get a more natural look, faster UI rendering and fewer errors.

Is there anyone who has already made such a port and wants to share some information, especially the flaws that we should expect? Thanks in advance.

PS: Maybe it should rather be a wiki, because there is no point in taking it as a final answer.

+6
java swing swt port
source share
2 answers

From my experience:

  • SWT is not available on all platforms. Make sure all target platforms are supported.

  • Bug fixes in SWT are much more complicated than in Swing: most classes in SWT are final or contain hostile checks in the constructor to make sure no one extends them, the package is signed (so you cannot just replace the classes), and still I tried several times to compile SWT from sources - and failed . With 47 thousand points in StackOverflow, one would imagine that I have to compile Java code ...

  • There are many custom components for Swing, SWT has only a project nebula that is not very active. Although it is possible to mix Swing and SWT components, which is not for the faint of heart.

PS: I still prefer SWT over Swing :-)

+6
source share

I am currently doing the same with the application I am writing. The lack of my own support - or even the correct "emulation" - of Swing widgets made me very upset. I use Ubuntu (and thus Gnome) during development, and immediately noticed that something simple, like drop-down menus, is completely incorrectly handled by Swing, but works fine with SWT (there are no borders around Swing, and menu items are disabled displayed completely differently than they would otherwise).

There are no serious hurdles to overcome, other than the fact that you need to completely rewrite your View classes, which you are likely to expect.

When you say SWT, you should probably also include JFace and RCP if the functions you implement require it. They probably do.

Final advice: don't you dare to mix them. You will regret it. The next release should be Swing or SWT - if you try to combine the two, you will encounter serious errors that could lead to loss of customers.

+2
source share

All Articles