model view controller - How to integrate a JMenuBar in an MVC architecture in Java? -


i'm using tutorial build application using mvc architecture : http://www.oracle.com/technetwork/articles/javase/index-142890.html. i'm not sure how or should put code build , add actionlistener of jmenubar inside of it.

furthermore, book object-oriented design & patterns cay horstmann "the controller may process mouse , keyboard events windowing system, or may contain user interface elements such buttons , menus." should follow advice, if yes, how should implement ? how add jframe in main class ?

as suggested in how use actions, action convenient way encapsulate this. moreover, action "can used separate functionality , state component."

addendum: in simple example, model file representing directory in file system, , view jlabel listens actionperformed(). encapsulation afforded action ensures each menu item , tool bar button produce same result. approach emblematic of swing's separable model architecture.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -