Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Observer/Observable and update(Observable o, Object arg)
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Tom Hawtin, post: 2848221"] The pattern is called "Observer". That doesn't mean you have to use the interface named Observer. IMO, Observer and Observable should have been deprecated in 1.1. The 1.1+ idiom is event listeners. If you use event listener, you can have one observer (the listener) with a number of methods. However, using listeners that try to work out what has changed is going to be a disaster. Swing is packed full of little bugs because of this problem, and it also has lots of hacks to prevent the problem. The best way is to assume everything that could have led to the event did cause it. Duplicate no state. If there is a performance problem, optimise but don't assume that the original state + event information gives you the current state. You could create a log of changes (as a database does). Then when a listener receives an event, process the entire log since last update. I have never seen this done. Tom Hawtin [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Observer/Observable and update(Observable o, Object arg)
Top