I have a class let's say MyJFrame
which represent the GUI of my application. It implements the interface Observer
and override the method update
.
public class MyJFrame extends JFrame implements Observer{
...
public void update(Observable arg0, Object arg1){
...
}
}
Now I want to make also my JFram an Observable object but I can't because it already extend the class JFrame
. I tried to create a variable of type Observable in my class.
public class MyJFrame extends JFrame implements Observer{
Observable observable = new Observable();
The problem here is that I can add Observer to this observable field and I can also notify the observer but I cannot invoke the method setChanghed()
(because it is declared as protected) which has to be called before the notification.
Do you have any idea about I can implement it?
Thanks!!