Is there another way to implement event listener (in general)?
posted 14 years ago
Hi all, I am having this feeling over and over when i need to attach a listener to a particular Container. When i create an applet or a frame with text fields and buttons, i have to implement the event listener on the applet/frame. If i want to create another class to implement the event listener, this class has to be an inner class of applet or frame so that it can access components(ie. textfields,...) of applet or frame. If the event listener is place outside the applet or frame, the getSource() method returns only the object that generates the events, it has no way to access other components in the same applet or frame. I need some advice on how to implement the event listener in separate class while still can access other components in the same applet/frame. Thanks.