Hi! My ambition is to put all listeners in a ClientController class but I can�t see how to do it. Normally I would have the listener as an inner class like this: public class ClientView{ xxxxx button.addMouseListener(new SearchListener()); xxxxx class SearchListener extends MouseInputAdapter{ public void mouseClicked(MouseEvent me){ button.setEnabled(false); } } } How can I put all listeners in the ClientController and how should the controller get access to the "button" ??? Does anybody have a good example?? //Cecilia
Sai Prasad
Ranch Hand
Joined: Feb 25, 2002
Posts: 560
posted
0
In your code, move the SearchListener to the controller from the view class and call setSearchListener(new SearchListener()) defined in the view from the controller constructor.
Cecilia Anderson
Greenhorn
Joined: Nov 11, 2001
Posts: 13
posted
0
Hmm...still don�t get it Should I put the SearchListener class as an inner class in the ClientController?? And if I do... what should I add to button.addMouseListener(??)
Ok, in your GUI class, the view you have a method like such. fileExit is a MenuItem
Then in your Controller to hook into the GUI so that it can run a method when an action occurs you have the following code. frontEnd is the reference to the instance of the GUI class that the controller has.
Hope that helps Mark [ May 10, 2002: Message edited by: Mark Spritzler ]