Results 1 to 4 of 4
-
Whats the best thing to do when you can't extend Observable?
Hi,
I have some classes which are subclasses of my other classes, for example:
I want to create a form to edit the object properties of my class, say "Lion Editor", so I wanted to extend ObservableJava Code:class Lion extends Animal { //but can't also extend Observable ... }
so that I could add the following Observable methods to the my class' setter methods:
Whats the best way to work around this?Java Code://a method specific to the subclass' object properties public void setManeLength(int length) { maneLength = length; // methods inherited from Observable: // setChanged(); // notifyObservers(); }
Thanks.
-
Re: Whats the best thing to do when you can't extend Observable?
One way: You could simply make your own observer framework and make your Observable an interface, not a class.
-
Re: Whats the best thing to do when you can't extend Observable?
Thanks. I don't know why I didn't think of that.
-
Similar Threads
-
to Extend or not to Extend
By fatabass in forum New To JavaReplies: 4Last Post: 12-21-2011, 04:28 PM -
Observer/Observable help...
By chyrl in forum Advanced JavaReplies: 5Last Post: 01-14-2011, 04:41 PM -
Observable/Observer JComboBox
By rudeboy in forum Advanced JavaReplies: 5Last Post: 11-27-2010, 06:03 AM -
Extend Jscroll
By cowboy in forum New To JavaReplies: 10Last Post: 12-13-2009, 08:07 PM -
using J-classes or extend them ?
By itaipee in forum AWT / SwingReplies: 1Last Post: 01-01-2009, 07:58 PM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks