title: What is the common way to program action listeners?
body: <p>I just started to learn how to use action listeners. To my understanding it works in the following way:</p>
  
  <ol>
  <li><p>There are some classes which contains "addActionListener" method by default (for example classes for buttons).</p></li>
  <li><p>Using this method we add an action listener to an object. For example: <code>listenedObject.addActionListener(listeningObject)</code>.</p></li>
  <li><p>When an action with the "listenedObject" is performed, the "actionPerformed" method of the "listeningObject" will be called. So, it means that when we program a class for the listeningObject, we need to put there "actionPerformed" method.</p></li>
  </ol>
  
  <p>What is not clear to me, should we create a new class for every object that we want to listen. It does not seem to me as an elegant solution. On the other hand, if we have one action listener class for all (or at least many) object, than we have a problem since a instance of this class will not know which object is calling the "actionPerformed" method (and we need to know that since actions performed by the actionPerformed differs depending on who is called for this method).</p>
  
  <p>In my opinion, for every listened object we need to create are "personal" action listener and we can do it by setting a specific value to the corresponding field of the action listener. But I am not sure that it is a standard way to go? How do usually people do it?</p>