• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About the MVC

 
Ying Ren
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,
I have a question about the MVC. Should I put the JTableModel and the related methods for creating the JTable and JComboBox in the View Class or Controller Class? How to implement them?
Thanks
Ying Ren
 
Robin Underwood
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My controller creates the views, but the views are responsible for creating their individual components (JTable, JComboBox, JButton, etc).
My table model is in the controller but is passed to the view that displays it.
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep the table model in the controller and take a look at this thread
 
Ying Ren
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply.
You means you have the main method in Controller Class, that is right? What is the difference if I put the main in the view? I am sorry, since I have read some articles about MVC,no one confirm that usage. Could you please give me some information about that?
Thanks
Ying Ren
 
Robin Underwood
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would put the main method in the controller (or in a separate startup class) since the controller is the decision maker. The views should only do what the controller tells them to do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic