java - Solutions to implement Observer pattern to my application -
i want implement observer pattern application.since code large sum problem. so, have make application manages relations between boss , employees. this, have 2 separate gui both boss , employee.
when lunch application create 2 loggins , 1 boss , 1 employee. if loggin boss succesfull create new gui boss frame
if employee loggin successfull new gui employee show up. want do, add new gui employee created (wich observable) observer (gui boss). here of code explain better:
//in application.java public static void main(string args[]){ ........ loginboss lb = new loginboss(contrb); //contrb boss controller lb.setvisible(true); loginemployee le = new loginemployee(contre); //contre employee controller le.setvisible(true); } //in logginboss.java //after check if it's ok create new gui boss guib = new guiboss(contrb,boss); //contrb boss controller passed loggin boss guib.setvisible(true); //in logginemployee.java ///after check if it's ok create new gui employee guie = new guiemployee(contre,employee); guie.setvisible(true); //now whant add guie gui boss observer, guie.addobserver(guib);
if have ideeas please, let me know.i'm sorry english.
take @ link.
if guiemployee
extends observer pattern, should make like:
guiemployee watched = new guiemployee(var, var); watched.addobserver(guib); watched.changesomevalue(value);
in changesomevalue
method,inside guiemployee (watched
in example) must include these sentences notify observers:
setchanged(); notifyobservers(value);
a call notifyobservers nothing until setchanged called. more info, take here.
Hello Admin,
ReplyDeleteI want enforce observer sample software.due to the fact that code huge sum problem. So, have make utility manages family members between boss , employees.
Regards,
Thanks
Mansi Sharma
Digital marketing is a rapidly evolving field that encompasses various strategies and techniques to promote products, services, and brands online.
ReplyDeleteBest Digital Marketing Institute in Hari Nagar
One of the greatest advantages of digital marketing is the abundance of data and analytics available.
ReplyDeleteBest Digital Marketing institute in Sarojini Nagar
Best Digital Marketing Institute in Rajouri Garden
ReplyDelete