• Post Reply Bookmark Topic Watch Topic
  • New Topic

SWT/JFace advantages?

 
Jan Rotthaus
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I really like the Eclipse IDE, but I didn't use SWT or JFace so far. Regarding some of the threads SWT/JFace has the following disadvantages:
  • platform-specific SWT native libraries
  • additional resource management required
  • The only advantage mentioned so far is the increased performance. Is it really all about performance? Or are there any other advantages?

    Jan
     
    Rob Warner
    author
    Ranch Hand
    Posts: 50
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I think the "native libraries" objection is far overblown; the JVM itself is a collection of native libraries, and Java apps use JNI in many places. The beauty of Java is that the JNI calls are all transparent to you, the programmer, and your Java code works on all platforms. SWT adheres to that model: you don't explicitly call any native code. You write your Java code once, and it runs anywhere. The target platforms just need the native libraries, in addition to the platform-specific SWT jar file and your non-platform-specific code. So, you offer a few different distribution files, one for each platform. Even some Swing apps do that, albeit for different reasons (platform-specific installation routines--see jEdit.

    Performance is a big reason to use SWT, and would be reason enough if that were the only reason. Sluggish apps just don't last long. Integration with the desktop is another reason however: SWT apps look exactly like native apps. People argue that Swing's "look & feels" offer the same thing, but they don't: they're necessarily behind, because someone's got to write and distribute them, and they don't adopt system-wide skinning (see Stardock for an example of system-wide skinning). Using native widgets is a big win.
     
    Jan Rotthaus
    Ranch Hand
    Posts: 56
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Rob,

    thanks for your detailed answer. I see that native widgets are a big plus, but to stay (at least sort of) platform-independent, SWT can only contain widgets that exist on all target plattforms - am I right?

    I think I will have a closer look on SWT,

    Jan
     
    Rob Warner
    author
    Ranch Hand
    Posts: 50
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Actually, to avoid the least-common-denominator approach that doomed AWT to mediocrity, SWT implements widgets in Java if no native counterpart exists on the target platform (e.g. tree controls on Motif).
     
    Jan Rotthaus
    Ranch Hand
    Posts: 56
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Cool
    That's really great! This will really help creating effective Java GUIs!
    Thank's a lot,

    Jan
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!