This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

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

 
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there something you want to do for which events aren't suitable to provide Observer/Publish-Subscribe functionality?
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right, thank you for the replies everyone!

Yuriy
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!