I have read a number of articles/explanations on implementing MVC (Model View Controller) design pattern with Java such as:
GUI not working after rewriting to MVC
and have visited several few more (including those in SO).
I am clear on what was explained in those links. However how should we implement a MVC when we have several JPanels/JFrames? So let say I want to implement a program which may display several JFrames at the same time.
Question: Should we try to only have 3 classes (Model, View, Controller) despite having multiple JFrames or should we have a separate View class for each JFrame?
I am aware that we could use the observer pattern to let various Frames communicate.
As for this link from SO, there is only 1 solution which does not address my question above: Java MVC multiple JFrame
I am also aware of The Use of Multiple JFrames, Good/Bad Practice?. But let's assume I will be having multiple JFrames which may display at the same time. I am more concern how would it be implemented with MVC.
Aucun commentaire:
Enregistrer un commentaire