swing - java MVC application -
i'm creating application @ moment want reuse gui make easy reuse , change elements i've been using mvc design pattern im having few issues first issue how implement actual design pattern different examples implement in different ways. code have in main, ok.
mainview theview = new mainview(); mainmodel themodel = new mainmodel(); maincontroller thecontroller = new maincontroller(theview,themodel); theview.setvisible(true);
the second problem have example set controller implemented view in using following code:
controller:
this.theview.addcalculatelistener(new calculatelistener());
view:
public void addcalculatelistener(actionlistener listenforcalcbutton){ calculatebutton.addactionlistener(listenforcalcbutton); }
this seems work fine have problems implementing listeners in jmenu there added within constructor of view plan create jmenu in external class can put menu items global variables (to clear code) allow me add listeners in manner, ok solution or way off.
Comments
Post a Comment