Java GUI 开发的未来? [英] Future of GUI development in Java?

查看:51
本文介绍了Java GUI 开发的未来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到

  • Sun/Oracle 在发明"JavaFX 后决定不再进一步开发 Swing
  • JavaFX 并没有真正起作用,有些人认为它已经失败了立>
  • SWT 并非真正独立于平台的性质、处理 GUI 元素的手动任务以及捆绑特定于平台的库的必要性

还有别的出路吗?

如果我想在JVM上做GUI开发

If I would like to do GUI development on the JVM

  • 具有良好的 API(Swing 和 SWT 还不错,但也不是很好.)
  • 感觉"响应迅速(尽管声称已经解决了问题,但今天仍然是 Swing 和 SWT 的问题.)
  • 在几年内不会过时我应该做出什么决定?

是否还有第三种选择,或者将来可能会有第三种选择?

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

一个选项

  • 快速响应(不是 Swing 的如果它不快,那就是开发者的错")
  • 具有原生外观
  • 使用一个可以在所有平台上运行的库

这现实吗?

谢谢!

==========

澄清:如果我必须在 JVM 上启动一个新的软件项目,有几个现有的选择,比如使用 SWT 或 Swing,使用 Swing 和第三方库,如 SwingX、JIDE、JGoodies、Flamingo 或使用应用程序框架像 Netbeans 平台或 Eclipse RCP.是否有一种支持/建议的方法可以减轻通常与 Java GUI 开发相关的痛苦?

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?

推荐答案

你不会找到这个问题的客观答案,只有个人喜好和选项.

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

我个人的偏好是 SWT.我开始使用它,当时 Swing 太糟糕了.SWT只是"位于本机窗口 API 之上的一层,因此用 SWT 编写的应用程序感觉就像本机编写的应用程序.这些也可以搞砸.任何 API 都不会受到不良开发人员的影响.根据我的经验,性能尽可能快.如果不是,那么还有另一种实现方式,它会在哪里.

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 的 API 非常低级,这使得实现基本的东西出乎意料地乏味,但幸运的是,大多数典型用例都可以用 JFace 解决,从而改善了这种情况.当您使用 API 一段时间后,您将积累自己的 util 类.您可以很快地实现 SWT 工具.

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.

由于 SWT 只为您提供基础知识,因此您需要 MigLayoutNebula 小部件来生存.您可能喜欢釉面列表.

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

实际上,除了 SWT 和 Swing 之外,我还想为您提供另一个选项: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".

尽管如此,我对正在进行的讨论感到兴奋.有些人使用 Qt Jambi 作为原生"API 编写了 SWT 实现.他们正试图弄清楚如何贡献它.有朝一日将 Qt 作为选项可能会为 SWT 启用在所有平台上运行的单一库",尽管我不会很快指望它.

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.

但对我来说,您对单一图书馆"的要求并不是什么大问题.使用 maven 进行构建,添加几行配置,您很快就会忘记这一点.

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.

我无法真正将 SWT 与 Swing 进行比较,因为我对 Swing 的经验有限.作为用户,我不喜欢大多数 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.

如今,Swing 应用程序的原生外观和感觉非常好,但您不会欺骗高级用户.此外,性能在新的和做得很好的 Swing 应用程序中似乎非常好,但同样,这只是我作为用户的有限观点.

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.

显然,Swing 的第 3 方扩展比 SWT 多——只需在 Google 上搜索即可.(但话又说回来,如果你忍受学习 Eclipse RCP 的痛苦,你也会得到一个巨大的、有趣的基础设施.不过这不是在谈论小部件,而是像 EMFRAP.我是没有 Eclipse RCP 人 - 我从来没有足够的耐心......)

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...)

对于 Swing 来说,一个真正重要的优势是 Matisse,Netbeans 的 GUI 构建器.顺便说一下,Qt 还有一个做得很好的 GUI 构建器.

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.

如果你有长远的打算,我看不到比 SWT 或 Swing 更适合用 Java 开发 GUI 的选择.如果您花足够的时间,两者都足以满足大多数需求.但它们并不完美.您总是会羡慕那些使用其他语言来制作小部件、实现速度、工具等的人……如果您不受 Java 的束缚,您甚至可能更喜欢 Flash 或 Qt.

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.

这篇关于Java GUI 开发的未来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆