Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there another way to implement event listener (in general)?  RSS feed

 
SoonAnn Lim
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!