views:

1517

answers:

5

Hello,

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.

A: 

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.

Dev er dev
I'm already using JGoodies Binding (free), and I'll seriously consider buying JGoodies whole Swing Suite (expensive). It is very high quality stuff indeed.
Joonas Pulakka
Can you add a link?
David Grant
http://jgoodies.com/
Joonas Pulakka
I wish it wasn't so expensive :(
Ryan Thames
Yep, but the base libraries are BSD licensed, and are quite good.
Dev er dev
A: 

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.

David Grant
SwingWiki does no longer exist.
David Segonds
+3  A: 

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.

Louis Jacomet
Thanks, it seems to cover at least ResourceMap and TaskMonitor classes.
Joonas Pulakka
A: 

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.

DJClayworth
The original question is about "Swing Application Framework" (aka JSR-296), not about Swing itself.
jfpoilpret
Oops. Just ignore me.
DJClayworth
+5  A: 

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

jfpoilpret
Thanks! I'll have a look at your slides.
Joonas Pulakka