Mot
Mot

Reputation: 29540

Swing to SWT conversion: which disadvantages?

We are considering to port our Swing applications to SWT/JFace to get a more native look and feel, more UI rendering speed and less bugs.

Is there anybody who already has done such a port and wants to share some information, especially disadvantages we should expect? Thanks in advance.

PS: Maybe this rather should be a wiki, because it makes no sense to accept one as the ultimate answer.

Upvotes: 6

Views: 1815

Answers (2)

Hut8
Hut8

Reputation: 6342

I am currently doing the same thing with an application that I am writing. The lack of native support -- or even proper "emulation" -- of widgets with Swing frustrated me very much. I use Ubuntu (and thus Gnome) when developing and immediately I noticed that something as simple as drop down menus are totally improperly rendered with Swing but work fine with SWT (in Swing, no border is drawn around them and disabled menu items are rendered totally differently than they would otherwise be).

There aren't any huge hurdles to overcome other than the fact that you have to totally rewrite your "View" classes, which is probably what you would expect.

When you say SWT, you should also probably include JFace and RCP if the features you're implementing call for this. They probably do.

Final advice: don't even dare mix the two. You will regret it. Your next release should either be Swing or SWT -- if you try to interop the two, you will run into serious bugs which will cause you to lose clients.

Upvotes: 2

Aaron Digulla
Aaron Digulla

Reputation: 328594

From my experience:

  • SWT isn't available for all platforms. Make sure all your target platforms are supported.

  • Fixing bugs in SWT is much harder 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 can't simply replace classes), and so far, I tried several times to compile SWT from sources - and failed. With 47K points on StackOverflow, one would imagine that I should be able to compile Java code...

  • There are lots of custom components for Swing, SWT just has project Nebula which isn't very active. While it's possible to mix Swing and SWT components, that's not for the faint of heart.

PS: I still prefer SWT over Swing :-)

Upvotes: 5

Related Questions