Which Java GUI framework to choose now? [closed]

2020-02-17 09:33发布

问题:

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 7 years ago.

Which GUI framework/library would you choose if you were to start your new project now or in the near future?

It has to be free for commercial use and cross platform.

I have been a happy swing user, but Sun seems like pushing swing to deprecation, while pushing Javafx, which is not yet ready for prime time.

There's also SWT, but it seems like it has issues on Linux.

What is your Gui library/framework of choice?

EDIT: Sun has canceled swingx project. From the forum comments on http://swingx.dev.java.net seems like majority of Sun resources that previously worked on core swing are now developing JavaFx full time.

回答1:

I think that despite Sun's mismanagement, Swing is still an excellent framework. You can do a lot with it, especially if that "lot" involves custom rendered UI controls. If your application needs a branded LAF, or even just a few complex custom controls here and there, Swing is exactly what you want.

On the other side of the coin, I do like SWT quite a lot. It gets a bad rap because everyone used to think it was IBM's ploy to take over Java, but it's really just another UI framework that is quite complementary to Swing. I would not advise using SWT for super-complex graphics rendering (specifically: compositing) or for creating really non-trivial custom controls, but for everything else it is really dandy. The API itself gets a lot of criticism because of things like reliance on bit masks and a user-managed event dispatch loop, but most of those things are pretty transparent once you get used to them. The components themselves are a lot simpler than Swing's (in terms of extensibility and similar), which means that the API can be proportionally simpler. I can actually remember how to create and populate a table in SWT; whereas I don't think I have ever handled that in Swing without Google's assistance.

SWT's biggest problem right now is the stable version depends on Carbon on Mac OS X. This means that SWT apps can only run 32bit on Java 5 (or 32bit on SoyLatte). As for other platforms, SWT is phenomenal on Windows (Vista and XP) and almost as good on GTK Linux. I have not (in recent past) had any issues with SWT on Linux, so I'm a bit surprised that you would mention it as a sore point.

Coming back to your question: it all depends on what your application needs. If it's a flashy custom-styled application with tons of custom controls and complex compositing, Swing is the only game in town. However, if a simpler API is more important to you, or if your users demand the ultimate in platform LAF fidelity, SWT is the best choice.



回答2:

Right now, I'm either using SWT or Qt (Jambi).

Swing didn't evolve in the last, say, 10 years, bugs aren't fixed, the development has stopped in favor of JavaFX, so you won't ever see any new features, too. JavaFX will probably look great but is still vaporware and it's made by the people who let Swing starve to death, so I'm not putting any money on it.

Between SWT and Qt, I prefer to use Qt because it's a very mature and powerful framework made by people who know what they are doing (well, most of the time anyway :)) and SWT if the license for the new project wasn't compatible to Qt's.



回答3:

I still use Swing, and will continue to do so until it is no longer supported at all. Thanks for the heads up about Javafx, I'll have to look into that one now.