Java GUI frameworks. What to choose? Swing, SWT, A

2019-01-02 16:25发布

There is quite a lot of gui frameworks out there for java, but what is recognized as today's framework of choice?

The following is my understanding of the different frameworks, please correct me if im wrong. This is a very loosely defined set of questions, but i still think its valuable for anyone thinking of creating rich gui applications.


AWT

Is the very foundation of swing, it performs well but is lacking in advanced components. If you intend to create rich applications, AWT is probably not the way to go. However for smaller gui applications that doesn't require rich user interfaces. This might suit perfectly as it's a tried and proven framework.


Swing

Based on AWT as previously stated. In its infancy it was regarded as slow and buggy and caused IBM to create SWT for Eclipse. However with Java 5 (or 6?) Swing became the framework of choice for building new applications. Swing has a lot of rich components but are still lacking in some areas. One example being that there isn't a full featured TreeTable component which can do sorting and filtering/searching.


SWT

Created by IBM for Eclipse, they seemed to think that Swing was not suited for Eclipse at the time. By itself is pretty low-level, and it uses the platform's native widgets through JNI. It is not related to Swing and AWT at all. Their API is however somewhat clunky and not intuitive. They do have some advanced component's like a TreeTable. (but i don't think they support sorting and filtering out of the box). SWT uses some native bindings (through JNI?) and the rant on the internet is that this framework should not be used in today's projects. (why not?)


SwingX

Based on Swing and it's mission is to create rich components for swing. Still under development. (not very active though.) Have a very nice set of components, like for example TreeTable. But the TreeTable does not support filtering and sorting as far as i know. It does however support searching with highlighting.

Note that SwingX is components (AFAIU) that are extensions or compositions of existing Swing components


JGoodies

A framework which i know nothing about... What is it's strengths and weaknesses? What set's Jgoodies apart from the rest?

JGoodies OTOH is about PLAFs and layouts.


JavaFX

The latest flagship of Java/Oracle. promising to be the facto standard in developing rich desktop or web applications.


Apache Pivot

It renders UI using Java2D, thus minimizing the impact of (IMO, bloated) legacies of Swing and AWT. (@Augustus Thoo)

It's main focus seems to be on RIA (Rich internet applications), but it seems it can also be applied to desktop applications. And as a personal comment, Looks very interesting! I Especially like that it's an apache project.

https://cwiki.apache.org/PIVOT/frequently-asked-questions-faq.html


Qt Jambi

A java wrapper to the native qt library which is written in c/c++. Very powerful, widely used and accepted. Has a lot of GUI components and a easy to use API.

http://qt-jambi.org/


So, to try to summarize a bit of what im asking:

Say i wanted to create a desktop application today in Java which involves a lot of advanced components, what should i choose? And why?

Which one of these frameworks should be recognized as deprecated and which should be recognized as the frameworks of the distant future?

What is todays de-facto-standard framework and which tools do you utilize to create java gui applications?


I might regret asking this, but ill try it anyways:

C#/.Net is said to have a very good set of easy to use components which can be flexed in every direction possible. And after investigating different java frameworks to some extent i can't seem to say the same about Java. Why is this? Why doesn't java (which is the most widely used programming language in the world) have the same set of GUI components?

Is it just that java has based their gui components at a much lower level, and it is possible to write all these advanced components that im looking for, but you have to do much if not all of the work yourself?

9条回答
旧人旧事旧时光
2楼-- · 2019-01-02 16:39

I've been quite happy with Swing for the desktop applications I've been involved in. However, I do share your view on Swing not offering advanced components. What I've done in these cases is to go for JIDE. It's not free, but not that pricey either and it gives you a whole lot more tools under your belt. Specifically, they do offer a filterable TreeTable.

查看更多
听够珍惜
3楼-- · 2019-01-02 16:47

I would like to suggest another framework: Apache Pivot http://pivot.apache.org/.

I tried it briefly and was impressed by what it can offer as an RIA (Rich Internet Application) framework ala Flash.

It renders UI using Java2D, thus minimizing the impact of (IMO, bloated) legacies of Swing and AWT.

查看更多
素衣白纱
4楼-- · 2019-01-02 16:47

you forgot for Java Desktop Aplication based on JSR296 as built-in Swing Framework in NetBeans

excluding AWT and JavaFX are all of your desribed frameworks are based on Swing, if you'll start with Swing then you'd be understand (clearly) for all these Swing's (Based Frameworks)

ATW, SWT (Eclipse), Java Desktop Aplication(Netbeans), SwingX, JGoodies

all there frameworks (I don't know something more about JGoodies) incl. JavaFX haven't long time any progress, lots of Swing's Based Frameworks are stoped, if not then without newest version

just my view - best of them is SwingX, but required deepest knowledge about Swing,

Look and Feel for Swing's Based Frameworks

查看更多
ら面具成の殇う
5楼-- · 2019-01-02 16:49

My personal opinion: Go for Swing together with the NetBeans platform.

If you need advanced components (more than NetBeans offers) you can easily integrate SwingX without problems (or JGoodies) as the NetBeans platform is completely based on Swing.

I would not start a large desktop application (or one that is going to be large) without a good platform that is build upon the underlying UI framework.

The other option is SWT together with the Eclipse RCP, but it's harder (though not impossible) to integrate "pure" Swing components into such an application.

The learning curve is a bit steep for the NetBeans platform (although I guess that's true for Eclipse as well) but there are some good books around which I would highly recommend.

查看更多
梦寄多情
6楼-- · 2019-01-02 16:53

Swing + SwingX + Miglayout is my combination of choice. Miglayout is so much simpler than Swings perceived 200 different layout managers and much more powerful. Also, it provides you with the ability to "debug" your layouts, which is especially handy when creating complex layouts.

查看更多
步步皆殇っ
7楼-- · 2019-01-02 16:54

Another option is to use Qt Jambi. It has nearly all the greatness of Qt (many components, good documentation, easy to use), without the hassle of C++. I used it 3-4 years ago for a small project, even then it was almost mature.

You might want to see the discussion about Swing vs. Qt here.

查看更多
登录 后发表回答