I'm designing a program in Java using an MVC layout. I need the view to initialize the buttons to run functions that the control defines. How can my view define an actionlistener that can run a function from a given class?
1 Answer
In Java, different view frameworks such as AWT,Swing or SWT, works on listeners. You need to add listener to a control(button in your case) and can call a method of a different class in your listener implementation.
In more generic terms, you can always make use of Observer pattern also to implement callbacks in any language.