title: Java implements ActionListener Problem
body: <p>In relation to my <a href="https://stackoverflow.com/questions/4843196/inner-class-problem-in-java">previous problem</a>, I now have a new problem. In order to avoid the inner class, my class now implements an <code>actionListener</code>. My code is as follows:</p>
  
  <pre><code>public class MainGame extends JDialog implements ActionListener {
  
      public MainGame(JDialog owner) {
          super(owner, true);
          initComponents();
          jPanel1.setLayout(new GridLayout(3, 9, 3, 5));
          for (char buttonChar = 'a'; buttonChar &lt;= 'z'; buttonChar++) {
              String buttonText = String.valueOf(buttonChar);
              letterButton = new JButton(buttonText);
              letterButton.addActionListener(this);
              jPanel1.add(letterButton);
          }
  
          newGame();
      }
  
      public void actionPerformed (ActionEvent action){
          if (action.getSource() == letterButton) {
              letterButton.setEnabled(false);
          }
      }
  </code></pre>
  
  <p>How can I effect the listener to my buttons A to Z? Because all it can listen to is the <strong>last button</strong> which in this case is button Z.</p>
  
  <p>Thank you.</p>