tags:

views:

204

answers:

2

Considering that

  • Sun/Oracle decided to not develop Swing any further after they "invented" JavaFX
  • JavaFX doesn't really work and some consider it a failure already
  • the not really platform-independent nature of SWT, the manual task to dispose GUI elements and the necessity to bundle platform-specific libraries

is there another way out?

If I would like to do GUI development on the JVM

  • with a good API (Swing and SWT are not bad, but they are not really good either.)
  • which "feels" responsive (still a problem today with Swing and SWT, despite the claims that this is solved.)
  • which won't be obsolete in a few years what decision should I make?

Is there even a third option available or a possibility there might be one in the future?

An option

  • which is fast and responsive (Not Swing's ideology of "If it's not fast, it is the developer's fault")
  • with native look and feel
  • with a single library which runs on all platforms

Is this realistic?

Thanks!

=========

To clarify: If I have to start a new software project on the JVM, there are several existing options, like using SWT or Swing, using Swing with third-party libraries like SwingX, JIDE, JGoodies, Flamingo or using application frameworks like Netbeans Platform or Eclipse RCP. Is there a supported/suggested way which weakens the pain normally associated with Java GUI development?

+3  A: 

The answer is prefer swing, I think.

  • since 1.4 there are big progress on awt (sun do that because java fx need awt, fortunately)
  • since 1.5 big progress in thread managment (SwingWorker and concurrents things)
  • swing is excellent, responsive (what the problem with developper fault ? ), native l&f, and so on
  • there are excellent libraries, like swingx, trident, etc, and platform, like netbeans.

Of course it is a mature technology (a little old), but I know nothing else. It will be cobol of GUI development :-)

Istao
+2  A: 

You won't find an objective answer to this question, only personal preferences and options.

SWT

My personal preference is SWT. I started using it, when Swing was to bad to be an option. SWT is "just" a layer on top of the native windowing APIs and thus applications written with SWT feel like natively written applications. Those can also be screwed up. No API will ever be safe from bad developers. The performance is as fast as it can get in my experience. If it is not, there is another way of implementing it, where it will be.

SWT's API is very low level which makes implementing basic stuff unexpectedly tedious, but fortunately most typical usecases can be solved with JFace, which improves the situation. And when you use the API for a while you'll accumulate your own util classes. You can become pretty fast in implementing SWT tools.

Since SWT gives you only the basics, you need MigLayout and Nebula widgets to survive. You might like Glazed Lists.

Qt Jambi

Actually I would have liked to include another option besides SWT and Swing for you: Qt Jambi. But Nokia gave up on this, and it is "maintained by an open source community" now. So I don't know about "not being obsolete in a few years".

Nevertheless I am excited by this ongoing discussion. Some people have written an SWT implementation using Qt Jambi as "native" API. They are trying to figure out how to contribute it. Having Qt as an option might enable your "single library which runs on all platforms" for SWT one day, though I wouldn't count on it anytime soon.

But for me your requirement of "a single library" is not such a big issue. Use maven for your builds, add a few lines of configuration and you'll forget about this very soon.

Swing

I can't really compare SWT to Swing, since my experience with Swing is limitted. As a user I don't like most Swing applications, but I did see some beatiful ones.

Nowadays the native look and feel of Swing apps got pretty good, but you won't fool a power-user. Also performance seems to be really good in new and well done Swing apps, but again, this is only from my limitted view as a user.

Obviously there are more 3rd party extensions for Swing than for SWT - just do a Google search. (But then again, if you endure the pain of learning Eclipse RCP you'll get an huge, interesting infrastructure as well. That's not talking about widgets though, that's stuff like EMF or RAP. I am no Eclipse RCP person - I never had enough patience for that...)

A really big advantage for Swing, if you like that stuff, is Matisse, the GUI builder of Netbeans. Qt has also a well done GUI builder by the way.

Summary

If you plan for long term, I don't see more options than SWT or Swing for GUI development in Java. Both are good enough to satisfy most needs if you spend enough time. But they are not perfect. You'll always envy people using other languages for their widgets, implementation speed, tooling, ... If you are not bound to Java, you might even prefer Flash or Qt.

the.duckman