Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to actually use Swing Application Framework?

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.

like image 900
Joonas Pulakka Avatar asked Feb 10 '09 12:02

Joonas Pulakka


1 Answers

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

like image 129
jfpoilpret Avatar answered Nov 10 '22 00:11

jfpoilpret