Hello, I'm a bit confused about MVC for this assignment. My code is finished and all is in one file, the client file. I'm afraid of being failed for not following conventions, so I would really appreciate someone clarifying how MVC works with this: I have a tabbedPane which has panels for searching and booking The searching panel has 2 comboboxes and a button to search. The booking panel has a JTable and a reservation button. How do I organize this to fit the MVC pattern. I know this is a long post, but i would appreciate your time in this, thanks much in advance.
The Controller is a completely seperate class. It knows about the GUI, and it knows about the Model, and handles actions for the GUI, and also passing the Model to the GUI. Think of a Mailman. Now think of Mail being sent to the Post Office without the sender saying I know exactly who this should go to. Instead the sender has no clue. But the Mailman knows who will be interested in getting the letter. So the Mailman sends the letter to who is interested in it. And maybe there are multiple people out there that would be interested in the letter, so the Mailman makes sure that each and every one of them gets the letter. The Mailman is the Controller. The Letter could be the "Data", the Sender I would link more to the Model, and the receivers could be different Views/GUI's to display the data. Or the Mailman is the Controller. The letter is some kind of Action that has occured. In this case the sender is a button on the GUI, it sends the letter. The Mailman sees which button is sending it and does some work to make some data changes, and sends the changes to the Model to change the Data. Hope that clears some things up, and the analogy is not too far fetched. Mark