• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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

 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic