aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Does anyone use java.util.Observer/Observable in Swing? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Does anyone use java.util.Observer/Observable in Swing?" Watch "Does anyone use java.util.Observer/Observable in Swing?" New topic
Author

Does anyone use java.util.Observer/Observable in Swing?

Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
I'm just starting learning Swing, and I was wondering if anyone actually uses java.util.Observer and java.util.Observable when writing MVC applications in Swing. It seems much cleaner to me for all relevent methods in both the Views and the Models to deal with application specific Model and View interfaces instead of the general Observer/Observable methods.

So what do people usually do?

Thank you,
Yuriy
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I made my own event publisher before I stumbled across Observer / Observable. It supports custom listener interfaces, arbitrary method parameters and return types and unsychronized life cycles. It takes a bit more typing (copy paste ) but does everything I need.
[ January 04, 2006: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
John Wetherbie
Rancher

Joined: Apr 05, 2000
Posts: 1449
Is there something you want to do for which events aren't suitable to provide Observer/Publish-Subscribe functionality?


The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Use them if you wish, but note that there is nothing special about them: they are not used in the API and if you look at their source code there is not much to them! There is also no common practice of using them widely in Swing app code, from what I'e seen. In short, no big wup.
[ January 05, 2006: Message edited by: Jeff Albrechtsen ]

There is no emoticon for what I am feeling!
Yuriy Zilbergleyt
Ranch Hand

Joined: Dec 13, 2004
Posts: 429
All right, thank you for the replies everyone!

Yuriy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does anyone use java.util.Observer/Observable in Swing?