title: method works in the constructor but not in the action listener
body: <p>my problem is that the method "findChampion" works only in the constructor, and I need to work within the action listener for use in the textfield.
  I think the problem was the champion object.try changing the method and static variables but did not work
  Thanks.</p>
  
  <pre><code>private JTextField textField;
  private Champion[] championsList;
  private boolean first = true;
  int previous = 0;
  public Finder(Champion[] champions) {
      setBounds(1,1,795,365);
      setLayout(null);
  
      championsList = champions;
  
      textField = new JTextField();
      textField.setBounds(354, 5, 107, 44);
      add(textField);
      textField.setColumns(10);
  
      //WORKS HERE
  
      for (int i=0;i&lt;championsList.length;i++)
      {
      if (textField.getText().equalsIgnoreCase(championsList[i].getName()))
      {
          if (first == false)
          {
          championsList[previous].removeChampion(this);
          }
          championsList[i].position(119,120,100,100,50,50);
          championsList[i].addChampion(this);
          previous = i;
          first = false;
      }
      }
      //
  
              //BUT DOESN'T WORK HERE
  
      textField.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
              findChampion();
          }
      });
      //
  
  
  }
  
  public void findChampion()
  {
      for (int i=0;i&lt;championsList.length;i++)
      {
      if (textField.getText().equalsIgnoreCase(championsList[i].getName()))
      {
          if (first == false)
          {
          championsList[previous].removeChampion(this);
          }
          championsList[i].position(119,120,100,100,50,50);
          championsList[i].addChampion(this);
          previous = i;
          first = false;
      }
      }
  }strong text
  </code></pre>