aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes MVC Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "MVC Question" Watch "MVC Question" New topic
Author

MVC Question

Jianping Wang
Ranch Hand

Joined: May 29, 2010
Posts: 60
I recently bought the HeadFirst Design Pattern and SCJD (authored by Monkhouse) and read them carefully. My question is about the model part of MVC. Because JTable has a model, and the M(odel) in MVC is also a model. Should we keep the JTable model in the big Model or keep it in the View? I can see the advantage of keep JTable model in View because when I select a record, I can disable or enable buttons by getting information from JTable model.


SCJP 6 with 93%
Oracle Database SQL Expert with 98%
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
Perhaps it's the fractal geometry of application design -- there's use of MVC both in the small scale and on the large scale.
Timur Pogorelov
Greenhorn

Joined: Jul 07, 2010
Posts: 3
Hi,

JTable belong to View as Swing (visual) component.

And element which implements AbstractTableModel belong to Model.

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5398
    
  13

JTable applies also a MVC: the model is represented by an implementation of TableModel (a custom AbstractTableModel or DefaultTableModel). So changing the content of your JTable occurs by passing a new TableModel to the JTable instance (calling method setModel(TableModel tableModel)). And the JTable will update its view.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MVC Question