Results 1 to 4 of 4
- 04-29-2012, 06:12 AM #1
Member
- Join Date
- Apr 2012
- Posts
- 12
- Rep Power
- 0
How exactly does a view listen to the model in MVC?
I understand the architecture. You have a model with data, a view that displays, and a controller that regulates between the two. What I don't understand is how you can update your view when the model changes (in push mvc format). Like if I have a textfield displaying an integer from my model, and my model changed, how would the textfield update?
I'm told in my specifications to "The role of ModelChanged is to update the current view due to changes in the model. This class will have a handler/listener that implements the actionPerformed."
Is there a specific type of action listener that knows when the model is changed?
- 04-29-2012, 06:27 AM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,605
- Rep Power
- 5
Re: How exactly does a view listen to the model in MVC?
- 04-29-2012, 07:08 AM #3
Member
- Join Date
- Apr 2012
- Posts
- 12
- Rep Power
- 0
Re: How exactly does a view listen to the model in MVC?
Thanks for the reply! I understand the link, but I was more wondering what specific listener code will query a model using actionPerformed? For instance, I could create a button that when pressed would access the controller who would then return the model's specific information to the view. But I have to click the button. How do I do this with something like a JTextField or a message or anything static, that doesn't require pressing?
- 04-29-2012, 09:01 AM #4
Similar Threads
-
Model View Controller Help
By gavo87 in forum NetworkingReplies: 0Last Post: 01-12-2011, 05:29 PM -
mvc-model view controller
By hannes in forum AWT / SwingReplies: 5Last Post: 01-08-2010, 05:52 AM -
Model View Controller with Java
By chopram in forum New To JavaReplies: 8Last Post: 06-07-2008, 09:18 PM -
Model-View-Controller
By Abnoba12 in forum Advanced JavaReplies: 1Last Post: 05-15-2008, 12:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks