This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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()!