Model-view-controller and Undo

D

Deniz Dogan

Hello!
I want to write a relatively small Java application using the MVC design
pattern and I have a question about where to put each of the objects.

I have a view (JFrame) consisting of two JFormattedTextFields and one
JTable with multiple rows and two columns. Whenever the user selects a
row "N" in the JTable the two text fields will show the String stored in
the cell on row N and column 1 and 2, respectively. The user may then
alter the information stored in the two cells of row N by writing text
directly into the text fields.
Using a certain command the user may also merge lines together.

That was a simplified description of the problem at hand. My question is
now: Should I store the TableModel in my model class or is it better to
keep it in the view class? Also, how would I go about implementing undo
functionality to this application? Where would I store the UndoManager?
In the model class or the view class?

-Deniz Dogan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top