I have two UI components as follows:
class UIPanel extends JPanel{ ... }
class MainPanel { Model m;
//instantiates UIPanel }
Issue here is that in UIPanel class I would like to add an ActionListener that would use Model to make decisions on how to process user action. Unfortunately I decided to split the two classes and I do not have access to Model directly. An obvious solution is to simply stick the UIPanel class inside the MainPanel, but I was thinking whether there was a way to keep the split.
You could simply give
UIPanela reference to theModel:This obviously is a quite tight coupling. Maybe
MainPaneldoes not need the reference to theModelat all?