• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Parent class event listener

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a main gui that calls out a form for the user to fill out as a child class. I want the parent class(main gui) to know when the user clicks a button, so I was wondering if it's possible to create an event listener connected to the button from the parent class. I made the button public and could create the action event listener for the button in the parent class, but it still wouldn't recognize the button being clicked. Any help would be great, thanks.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your idea seems to work okay in the code below. You could also leave the listener in the same class as the component that it's registered on and have it call a method in the parent class to handle the notification of event occurrence.
 
reply
    Bookmark Topic Watch Topic
  • New Topic