Here's 2 option that i thought of.
Have multiple models each representing one class. If i have 2 int object, i need to create 2 observable and have view checking which observable is changed.
In a single observable (model), group multiple object of the same class into Array. In view i will have to iterate the array and change all fields containing all data in the array.
I am starting to learn how to implement MVC pattern, using java observable and observer. I find the 2 methods which i have mentioned is not the best solution. Hope can get some help on this.
Edit: Example, i have the following methods in observable class, can someone show me how to write the update() in observer to get the value of int b?
public void setIntA(int a){
this.intA = a;
setChanged();
notifyObservers(a);
}
public void setIntB(int b){
this.intB = b;
setChanged();
notifyObservers(b);
}
setIntA(5);
setIntB(3);