title: action handling thru different frames
body: <p>I have a design problem that seems somewhat basic, but I am struggling to find an adequate solution as I don't have much experience in OO design.</p>
  
  <p>I have a system that has got a lot of frames in which the user needs to identify the enterprise/corporation. One way of doing so is clicking on a button which will open a second frame which enables the user to select the company. After the selection has been made, the corporation's code and name should be initialized in textfields on the original frame.</p>
  
  <p>I don't think its a good design choice to duplicate the action code in every single frame that needs the company identification. Still, I don't see how I would be able to create a single <code>ActionListener</code> (or <code>javax.swing.Action</code>) without a reference to the frame which triggered the action because I wouldn't be able to initialize the textfields (or would I?). </p>
  
  <p>My first idea was to implement a common interface for all frames which would need the search service with a single method like <code>setCorporation(Corporation corporation)</code>. That way, when I create an <code>ActionListener</code>, I would pass a reference of an instance of a frame which implemented the interface.</p>
  
  <p>The problem is that this solution would create double references (<code>addActionListener(new SearchAction(this))</code>) and I would have to implement an interface for every problem alike (like searching clients).</p>
  
  <p>What's the best approach to this kind of problem?</p>