Its common to use an inner class when adding an ActionEvent to a listener, for example in Swing. This removes the need to conditionally test what button has been clicked in a function to designate the appropriate action: A quick sketch example would be....
The inner class would then extend the relevant abstract classes for action-Events and the overridden method ActionPerformed() will handle the button click. Take a look also on the Swing Forums here at the ranch.
be a well encapsulated person, don't expose your privates, unless you public void getWife()!