• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Model for the JTable

 
Amit Kr Kumar
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark
Who should set the TableModel for JTable using table.setModel(new MyTableModel())
1) The View itself
or
2) The GUI controller
What i believe is that the View should not be worried abt the model.
How did u handled this ???
As far as origin and destination airports are concerned, the mode selection form controller pass it to the Booking Form constructor as:
obj = new BookingForm(DataInfo[] roigin, DatraInfo destination[])
obj.show()

Is this correct ???
Amit
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the Controller handle it.
Mark
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I were to implement the MVC PATTERN for the FBN application then I should have three components i.e FBNModel, FBNView and FBNController. I know that FBNModel encapulates data, FBNView would basically be the Frame containing the JTable and FBNController would basically be used for taking care of user actions on the front-end and transfer them to FBNModel for fetching new set of data and use this data to refresh the FBNView. Please correct me if I am wrong in interpreting the MVC pattern.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yuo are basically correct. But the Model does not know about the View, so it is still the Controller that handles it all for you.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic