I am learning Java and I want to make my class into an observable class.
However I already have it extending another class.
What should I do?
Another option is to wrap your object in an Observable object.
public class MyObjectObservableWrapper implements Observable {
private MyObject myObject;
public MyObjectObservaleWrapper(MyObject myObject){
this.myObject = myObject;
}
// interface methods here
}
This option works when the data to be used by the Observable methods is accessible through public methods of MyObject. So, it may not be suitable for all cases.