title: Java Listener Design Pattern for Subscribing
body: <p>I am trying to design a Java system that is simliar to the concept of c# delegates.</p>
  
  <p>Here is the basic functionality i wish to achieve:</p>
  
  <pre><code>public class mainform
  {
     public delegate onProcessCompleted
  //......
      processInformation()
      {
              onProcessCompleted(this);
      }
  
  //......
  }
  
  
  //PLUGIN
  
  public class PluginA
  {
          public PluginA()
          {
              //somehow subscribe to mainforms onProcessingCompleted with callback myCallback()
          }
  
          public void myCallback(object sender)
          {
          }
  
  
  }
  </code></pre>
  
  <p>I have read through this site: <a href="http://www.javaworld.com/javaqa/2000-08/01-qa-0804-events.html?page=1" rel="noreferrer">http://www.javaworld.com/javaqa/2000-08/01-qa-0804-events.html?page=1</a></p>
  
  <p>They make reference to implementing the whole 'subscription list' manually. But the code is not a complete example, and I'm so used to c# that I'm having trouble grasping how I could do it in java.</p>
  
  <p>Does anyone have a working examle of this that I could see?  </p>
  
  <p>thanks<br>
  Stephanie</p>