Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

AbstractTableModel and MVC pattern

lfdApr 16 2012
I'm stuck because I'm not sure I'm following the MVC pattern correctly.

In my View, I want to create a JTable using a custom class that extends AbstractTableModel. Following the examples in the Java Tutorial, it works only because I'm hard coding the Object [][] data values. What I want is for the Model to generate the Object [][] data and have the custom class that extends AbstractTableModel call the Model method that returns the Object [][] data.

My problem is, the way the application launches, the View is a singleton, so I'm getting an instance of the view, then I pass that instance as a parameter to the constructor of my model which I don't have yet when the View instantiates the JTable.

As I am understanding the MVC pattern, the View has no instance members of Model or Controller. Model has an instance member of View. Controller has instance members of View and Model. Is this right?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 14 2012
Added on Apr 16 2012
0 comments
161 views