简体   繁体   English

是否有比Swing更好的Java应用程序框架?

[英]Is there a better Java application framework than Swing?

I'm planning to work on some hobby Java projects. 我打算在一些业余爱好Java项目上工作。 I've done some small-scale projects, so I'm familiar with the language itself and building a GUI with Swing. 我做过一些小规模的项目,所以我熟悉语言本身并使用Swing构建GUI。 I'd like to make my work a little less ad-hoc and perhaps find some tools that might be useful out in the real world. 我想让我的工作不那么特别,也许会找到一些可能在现实世界中有用的工具。

NetBeans now comes bundled with the Swing Application Framework , which seems to be a very useful tool. NetBeans现在与Swing应用程序框架捆绑在一起,这似乎是一个非常有用的工具。 It helps bridge the gulf between knowing how to create a JFrame and how to use one effectively in the context of a larger application. 它有助于弥合了解如何创建JFrame以及如何在更大的应用程序的上下文中有效地使用JFrame之间的鸿沟。 The problem being that there are large chunks of the API completely undocumented and there's virtually no documentation on how to use it. 问题是,有大量的API完全没有记录,并且几乎没有关于如何使用它的文档。 There are only two questions in the FAQ, the mailing lists are all but dead, and I can't even tell if the project is being actively developed or if it's been abandoned. 常见问题解答中只有两个问题,邮件列表几乎已经死了,我甚至无法判断项目是否正在积极开发或是否已被放弃。 I've managed to get up and running with it based largely on the two-year-old JavaOne presentation posted on the project's home page. 我已经成功地开始运行它,主要基于项目主页发布的两年前的JavaOne演示文稿

Is there a better alternative? 还有更好的选择吗? Is another tool/library/API out there that does the same sort of thing in a slightly more newbie-friendly way? 是否有另一个工具/库/ API以更新手友好的方式做同样的事情? Note that I'm planning to develop desktop applications at the moment, and am not looking for J2EE frameworks like Spring and Hibernate. 请注意,我目前正计划开发桌面应用程序,而不是在寻找像Spring和Hibernate这样的J2EE框架。

The basic principles for creating a good desktop are the same for creating web or enterprise applications. 创建良好桌面的基本原则与创建Web或企业应用程序相同。 So the core of Spring or other frameworks such as OSGi or PicoContainer can easily be used outside of J2EE. 因此,Spring或其他框架(如OSGiPicoContainer)的核心可以轻松地在J2EE之外使用。 For example, Eclipse uses OSGi as its internal framework. 例如, Eclipse使用OSGi作为其内部框架。 The original use of the Model-View-Presenter (MVC) pattern was for Smalltalk GUI widgets. Model-View-Presenter(MVC)模式的最初用途是Smalltalk GUI小部件。

In fact, for myself, I first found and worked with "IoC" frameworks (long before Spring) precisely because I was looking for a framework and organizing principles for desktop application development. 实际上,对于我自己来说,我首先发现并使用“IoC”框架(早在Spring之前),正是因为我正在寻找一个框架并组织桌面应用程序开发的原则。

Update on RCP RCP更新

I see some people are recommending Eclipse RCP or Netbeans. 我看到有些人推荐Eclipse RCP或Netbeans。 I've done quite a bit of Eclipse RCP development and for certain classes of applications, it's great. 我做了很多Eclipse RCP开发,对于某些类的应用程序,它很棒。 However, the learning curve is very steep and the feature set may be way more than you need. 但是,学习曲线非常陡峭,功能集可能比您需要的更多。 Keep that in mind for any framework you investigate. 对于您调查的任何框架,请记住这一点。

For more complete frameworks: 对于更完整的框架:

The NetBeans platform perhaps http://www.netbeans.org/kb/trails/platform.html NetBeans平台也许是http://www.netbeans.org/kb/trails/platform.html

Or the Eclipse RCP http://www.eclipse.org/articles/Article-RCP-1/tutorial1.html 或Eclipse RCP http://www.eclipse.org/articles/Article-RCP-1/tutorial1.html

For a GUI library I'd lean towards SWT . 对于GUI库,我倾向于SWT Eclipse maintains it and uses it for its IDE. Eclipse维护它并将其用于IDE。 I believe Azureus used it too. 我相信Azureus也使用它。 Looks good on multiple platforms and pretty easy to use. 在多个平台上看起来很好,非常容易使用。

If i were starting a Java based desktop application today, i would use JavaFX. 如果我今天开始使用基于Java的桌面应用程序,我会使用JavaFX。

http://en.wikipedia.org/wiki/JavaFX http://en.wikipedia.org/wiki/JavaFX

You could also use the Java bindings of Qt. 您也可以使用Qt的Java绑定。 Qt is a multi-platform C++ framework which has, in my opinion, one of the most readable object models for GUI design. Qt是一个多平台的C ++框架,在我看来,它是GUI设计中最易读的对象模型之一。

Have a look at the Trolltech (Nokia) Qt website . 看看Trolltech(诺基亚)Qt网站

You can see a demo (which also has source code) using the Java Web Start feature. 您可以使用Java Web Start功能查看演示 (也包含源代码)。 It gives a good impression about what can and can't be done, and how the source code looks. 它给出了关于可以做什么和不可以做什么的好印象,以及源代码的外观。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM