title: Using ActionListener in a different class
body: <p>I have an exercise in my Computer science class where i am learning to use Action listeners in Java Applets. Though I'm slightly confused and could do with some help! Here is the exercise that i have to perform:</p>
  
  <p>"Provide a single button handler class for the three buttons.  The constructor should take as its arguments the reference to the applet and an appropriate integer value for the size. Add addActionListener calls to the init method (i.e. each should create a new handler object dedicated to the particular button). Compile and run your applet."</p>
  
  <p>Iv created a button handler class and created the constructor (i think i done it correctly). My main problem is the "add addActionListener calls to the init method" part. </p>
  
  <p>Here is the ButtonHandler class i created:</p>
  
  <pre><code>      class ButtonHandler implements ActionListener {
  
          Square theApplet;
  
          ButtonHandler(Square app){
              theApplet = app;
          }
   }
  </code></pre>
  
  <p>After that i tried to add an addActionListener in the init method that the buttonhandler has to call to.</p>
  
  <pre><code>     butSmall.addActionListener(ButtonHandler());
  </code></pre>
  
  <p>But this gives me errors. Anyone that could explain how to complete this exercise ? Thank you.</p>