The Artima Developer Community
Sponsored Link

Java Answers Forum
Jbutton model or view controller in mvc

2 replies on 1 page. Most recent reply: Aug 25, 2006 10:42 AM by Amol Brid

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
nila cool

Posts: 1
Nickname: twinkle
Registered: Aug, 2006

Jbutton model or view controller in mvc Posted: Aug 24, 2006 6:49 AM
Reply to this message Reply
Advertisement
I would like to know that jbutton is consider as a model or a view,controller in mvc architecture.if its only view controller how?.or if its only model means how?.or its model,view and controller means how?..plz explain


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: Jbutton model or view controller in mvc Posted: Aug 24, 2006 11:57 PM
Reply to this message Reply
> I would like to know that jbutton is consider as a model
> or a view,controller in mvc architecture.if its only view
> controller how?.or if its only model means how?.or its
> model,view and controller means how?..plz explain

Its a Swing component it encpsulates all of the above.

The class has a method (via inheritance from AbstractButton)
addActionListener, which is an example of the Controller.

The JButton itself is a JComponent (View). Things like
setText(String) and getText() provide access to data
objects on the Component (The Model).

Thats my current understanding of it, if I have this twisted
could someone please correct me?

Amol Brid

Posts: 43
Nickname: amolbrid
Registered: Feb, 2004

Re: Jbutton model or view controller in mvc Posted: Aug 25, 2006 10:42 AM
Reply to this message Reply
JButton is a view-controller and model can be any class which implements ButtonModel. The default model for JButton is DefaultButtonModel class.

For MVC read
http://www.javaworld.com/javaworld/jw-04-1998/jw-04-howto.html
http://java.sun.com/products/jfc/tsc/articles/architecture/

~Amol Brid.

Flat View: This topic has 2 replies on 1 page
Topic: Framework & Technology Previous Topic   Next Topic Topic: Display the number of times a particular word appears in a sentence

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use