C
***C.Steamer***
Say I got a class that extends JPanel and I want to update the model class
from within the JPanel class, what is the best way to do that. I already
implement an Observer pattern to update the GUI from the model but how do we
go the other way. Basically I will be clicking on an area of the panel and
based on which object I select I want to change something in the model
class. Should I just pass in all the classes that the GUI will need? I don't
like this method cuz then you have to have the classes already instantiated
before you build the gui and it makes for intermixed code. Or should I make
the model class into Singleton so I can statically access the class from
anywhere? Thanks for your help?
from within the JPanel class, what is the best way to do that. I already
implement an Observer pattern to update the GUI from the model but how do we
go the other way. Basically I will be clicking on an area of the panel and
based on which object I select I want to change something in the model
class. Should I just pass in all the classes that the GUI will need? I don't
like this method cuz then you have to have the classes already instantiated
before you build the gui and it makes for intermixed code. Or should I make
the model class into Singleton so I can statically access the class from
anywhere? Thanks for your help?