如何实际使用Swing应用程序框架?

发布于 2024-07-13 01:04:22 字数 1673 浏览 5 评论 0原文

我想了解如何有效地使用 Swing 应用程序框架。 我发现的大多数示例都是博客文章,它们只是解释了如何扩展 SingleFrameApplication 并覆盖其启动方法,但仅此而已。 Sun 的文章 已经有近两年的历史了,项目自己的介绍,从那时起显然已经发生了一些演变。

是否有任何最新且详尽的教程/HOWTO? 当然有 JavaDoc,但很难从那里了解全局。 任何指示表示赞赏。

更新:我意识到有一个邮件列表存档< /a> 在项目站点。 虽然有点笨拙(与 StackOverflow 相比;),但它似乎相当活跃。 但遗憾的是,没有任何地方有真正的教程。 信息分散在这里那里。

更新 2: 让我澄清一下 - 我在使用 Swing(小部件工具包)本身时没有遇到问题,我说的是它的应用程序框架,它应该可以缓解问题例如应用程序生命周期(启动、退出以及它们之间发生的任何事情)、操作管理等 - 也就是说,大多数 Swing 应用程序都需要这些东西。 让这样的框架成为Java的标准部分真是太酷了。 唯一的问题是了解它的用途。

更新 3:对于感兴趣的人,项目论坛上仅就 JSR 296 的当前状态和未来进行了一些讨论。很快:当前版本 1.03 被认为非常有用,但是 API 不稳定,更改为 Java 7 中的最终版本。包名称也会更改,因此 Java 7 不会破坏 SAF 上当前的应用程序。

更新4:Karsten Lentzsch在上述论坛上表示:“我怀疑它是否可以包含在Java 7中;我会投票反对它。”。 我不想质疑这位伟大大师的诚意,而且不让任何有缺陷的东西溜进 JDK 核心当然是明智的,但坦率地说,这是一个奇怪的情况 - 他是 JGoodies Swing Suite 的作者,该套件在一定程度上是 JGoodies Swing Suite 的商业竞争对手JSR 296,他是委员会的一员,该委员会将决定是否将此 JSR 包含到标准 Java 中。 我之前写过的 JSR 295 Beans Binding 也是如此。

鉴于 SAF 的当前状态,我认为最好的解决方案是将当前的实现包装到“自制”框架中,然后该框架可以适应对现有 API 的可能更改。

I'd like to learn how to effectively use Swing Application Framework. Most of the the examples I've found are blog entries that just explain how to great it is to extend SingleFrameApplication and override its startup method, but that's about it. Sun's article is almost two years old, as is the project's own introduction, and there has apparently been some evolution since then.

Are there any recent and thorough tutorials/HOWTOs available anywhere? There is JavaDoc of course, but it's hard to get the big picture from there. Any pointers are appreciated.

Update: I realized that there's a mailing list archive at the project's site. While somewhat clumsy (compared to StackOverflow ;) it seems to be quite active. Still it's a pity that there are no real tutorials anywhere. The information is scattered here and there.

Update 2: Let me clarify - I'm not having trouble using Swing (the widget toolkit) itself, I'm talking about its Application Framework, which is supposed to ease things like application lifecycle (startup, exit and whatever happens between them), action management etc. - that is, things that most Swing applications will need. It's cool to get such framework to be standard part of Java. The only problem is to learn how it's intended to be used.

Update 3: For the interested, there was just some discussion at the project's forum regarding the current state and future of JSR 296. Shortly: the current version 1.03 is considered to be quite usable, but the API is not stable and it will change to the final version in Java 7. The package name will also change so Java 7 will not break current applications made on SAF.

Update 4: Karsten Lentzsch stated at the above mentioned forum: "I doubt that it can be included in Java 7; and I'll vote against it.". I would rather not question the sincerity of this great guru, and it's certainly wise not to let anything flawed to slip into the core JDK, but frankly it's a strange situation - he is the author of JGoodies Swing Suite which is partly a commercial competitor of JSR 296, and he is sitting in the committee that will decide whether this JSR will be included to standard Java. It was the same thing with JSR 295 Beans Binding which I wrote about earlier.

Given the current state of SAF, I think the best solution is to wrap the current implementation into a "homebrew" framework, which can then accommodate possible changes to the existing API.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

青衫负雪 2024-07-20 01:04:23

首先,我个人的建议是不要使用最新版本的 SAF,它更像是“正在进行的重构”(而且这已经 6 个月没有发展了......)

我更喜欢版本“1.03”,尽管并不完美,但更加稳定和可用(我的意思是在现实生活中的应用程序中)。

确实,有关 SAF 的资源很稀缺。 我记得我遵循了这条道路:

  • 阅读JavaOne 2007研讨会
    关于它; 这给出了相当好的
    有关它的图片

  • 使用它并在需要时阅读 javadoc

  • 有时会查看源代码以弥补 javadoc 的不足

邮件列表当前并不那么活跃(但确实,自今年年初以来,流量刚刚重新启动了一点,但是,自 2008 年 8 月或 9 月以来,我还没有看到任何 Sun 代表!

)今年,经过大约一年的 SAF 实践,我在 Jazoon'08 上发表了演讲,您可以找到幻灯片 在我的博客上。 这次演讲更多的是关于技巧和技巧。 我在使用该框架时收集的技巧。

有时我还必须自己修补一些问题,因为许多问题是长期存在的(有些对我来说不重要,有些则阻碍)。

我记得在瑞典的一次会议上看过(没有参加过)关于 SAF 实践的另一场演讲,抱歉不记得更多细节了。 也很有趣。

据我所知,这几乎就是它存在的内容。

First of all, my personal advice would be not to use the latest version of SAF which is more like "refactoring in progress" (and this has not evolved for 6 months now...)

I much prefer version "1.03" which, although not perfect, is much more stable and usable (I mean in a real-life application).

It is true that resources about SAF are scarce. I remember I followed this path:

  • read a JavaOne 2007 seminar
    about it; this gives quite a good
    picture about it

  • used it and read javadoc whenever needed

  • sometimes took some looks at the source code to palliate javadoc lacks

The mailing list is not that active currently (but it's true traffic has just restarted a little bit since the beginning of the year, however, I haven't seen there any Sun representative since August or September 2008!)

Last year, after about one year of practice with SAF, I have presented a talk at Jazoon'08, you can find the slides on my blog. This presentation was more about tips & tricks I gathered while using the framework.

Sometimes I also had to patch some points by myself because many issues are long standing (some not important to me, some other blocking).

I remember having seen (not attended) another presentation about SAF practice in a conference I think in Sweden, sorry can't remember more detail. Was interesting also.

That's pretty much what exists about it (to my knowledge).

鲸落 2024-07-20 01:04:23

Netbeans 6.5 具有框架应用程序,可以为您提供良好的启动。 只需从 IDE 中创建一个新项目并选择 Java > Java 桌面应用程序。

Netbeans 6.5 has skeleton applications that can give you a good kickstart. Just create a new project from within the IDE and select Java > Java Desktop Application.

旧话新听 2024-07-20 01:04:23

从来没听说过。 我决定避免使用 swing 应用程序框架,直到它成熟(或消亡)。 我决定使用 jgoodies 库来等待 Sun 为 swing 开发人员做一些事情。

Not that I know of. I decided to avoid using swing app framework until it matures (or dies). I decided to use jgoodies libraries instead to wait for Sun to do something for swing developers.

太阳哥哥 2024-07-20 01:04:23

你可以看看 SwingWiki,它有一系列最佳实践和教程,尽管它没有更新了两年左右。

You could take a look at SwingWiki, which has a series of best practices and tutorials, although it hasn't been updated for about two years.

清醇 2024-07-20 01:04:23

虽然在过去两年中 Swing 确实发生了一些演变,但基本原理并没有太大变化。 我将从 Sun 自己的教程开始。

如果您想要书籍,那么常见的嫌疑人(麦格劳·希尔(McGraw Hill)、奥莱利(O'Reilly))和其他人可以为具有各种知识水平的人提供大量书籍。 有些书籍用其旧名称“Java 基础类”或 JFC 来引用 Swing。

While it is true that there has been some evolution of Swing in the last two years, the fundamentals haven't changed much. I would start with Sun's own tutorials.

If you want books then plenty are available from the usual suspects (McGraw Hill, O'Reilly) and others for those with all levels of knowedge. Some books refer to Swing by its old name "Java Foundation Classes" or JFC.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文