I created a Java application that kept basketball stats for a team of players. The first time I made the program, the GUI elements created actions that were dealt with in the same class, then the players were modified.
I am interested in rewriting the program following an MVC model. I assume I will need a view or GUI, then a model (Player), and a controller.
The controller is hard to understand for me. How do I pass what happened in the GUI to the controller? For instance, in the old program, I had 5 JComboBoxes
and I would have an Array
of int
in order to keep track of the active players. The currently selected player would have his stats updated if an event was recorded under his name.
How would I go about this using the MVC model, would I need an instance of Controller for each Player?
Here is a picture of the old GUI so that you can visualize how the program works.
Thank you for any suggestions.