本文介绍了如何组织 Swing GUI 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Swing 编写了一些 GUI 并且我了解 MVC,但是我从来没有找到真正以某种方式组织我的代码的好方法.我正在寻找的是类似于 maven 为每个新项目引入的文件夹结构.另一个例子是 rails,其中 MVC 是通过文件夹结构自动引入的.Swing 有没有类似的东西?

I've written a few GUI's using Swing and I know about MVC, but I never found a good way to really organize my code somehow. What I am looking for is something like the folder structure that maven introduces for each new project. Another example is rails, where MVC is introduced through the folder structure automatically. Is there something similar for Swing?

如果能看到一本描述大型 Swing 应用程序开发的书也会很高兴.我找到的都是关于设计指南的书籍,其中设计是指应用程序的外观.其他 Swing 书籍(如 O'Reilly)详细描述了所有 Swing 组件,但哪里有关于全局的信息?

It would also be nice to see a book that describes the development of a larger Swing Application. All I find are books about design-guidelines where design refers to the look of the application. Other Swing books (like O'Reilly) describe in detail all the swing components, but where is any information about the big picture?

是否有任何很好的 Swing gui 示例,您会说这就是您组织代码/文件夹/包用于 Swing 的方式!"?

Are there any good examples of a swing gui, where you'd say "That's how you organize code/folders/packages for swing!"?

我找到了以下站点 http://www.ibm.com/developerworks/java/tutorials/j-springswing/section7.html 描述了在创建 GUI 时使用 spring.这是一个相当古老的例子,它没有回答我的问题,但它是朝着正确方向迈出的一步.它还提到了 Spring RCP,但我不确定它是否可以成为解决方案.

I found the following site http://www.ibm.com/developerworks/java/tutorials/j-springswing/section7.html which describes the usage of spring while creating a GUI. It is a quite old example and it doesn't answer my question, but it is a step into the right direction. It also mentions Spring RCP, but I'm not sure if it could be the solution.

我仍然没有找到更好的答案.有没有人知道一个理想结构的 Swing GUI 的例子,它是开源的?有没有人知道一本书,描述它?如果不是用于 Swing,那么可能是用于一般的 GUI 吗?

I still didn't find any better answers. Does anybody know an example for a ideally structured Swing GUI which is Open Source? Does anybody know a book, which describes it? And if not for Swing, then maybe for GUI's in general?

推荐答案

虽然是 Groovy,不是 Java,我还是建议你看看 Griffon,这是一个Grails for Swing".

Although it is Groovy, not Java, I would advise you take a look at Griffon, which is a "Grails for Swing".

它对您使用它构建的所有应用程序强制执行给定的结构(在目录和模式方面,特别是 MVC).

It enforces a given structure (in terms of directories and patterns, MVC in particular) to all applications you build with it.

我认为它可以为您提供一般的好主意,尽管您必须对 Java 进行一些调整.

I think it can give you good ideas in general, although you would have to perform some little adaptation to Java.

此外,请注意 Griffon 还支持使用 Java 构建应用程序,并且它也可能为此提供原型",因此您也可以检查一下.

Besides, please note that Griffon also supports Application building in Java, and it may also provide "archetypes" for that, so you could check that as well.

这篇关于如何组织 Swing GUI 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 06:47