title: Sequential search does not work as expected
body: <p>I have written a program which takes the words the user have entered, with a button press, and puts them in an ArrayList. There is also another text field where the user can enter a letter or word, for which the user can search for in the ArrayList with another button press. I'm using a sequential search algorithm to accomplish this, but it does not work as I expect it to; If the searched word is found, the search function should return, and print out in a textArea that the word was found and where in the array it was found. This works, but only for the first search. If the word is not found, the function should print out that the word was not found. This works as I want it to.</p>
  
  <p>The problem is that after I searched for one word, and it displays where in the ArrayList this can be found, nothing happens when I press the button after that, whether the entered letter/word is in the array or not. It's like the string that the text gets stored isn't changing. I don't understand why... Here below is the custom <code>Class</code> of the search function and then my <code>Main</code> class:</p>
  
  <pre><code>public class Search {
      static private int i;
      static String index;
      static boolean found = false;
  
  public static String sequencial (ArrayList&lt;String&gt; list, String user) {
      for (int i = 0; i &lt; list.size(); i++) {
          if (list.get(i).equals(user)) {
              index = "The word " + user  + " exist on the place " + i + " in the Arraylist";
              found = true;
          }
      }
      if (!found) {
          index = "The word " + user + " could not be found";
      }
      return index;
  }
  </code></pre>
  
  <p>My <code>Main</code> class:</p>
  
  <pre><code>ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();
  ArrayList&lt;String&gt; s = new ArrayList&lt;String&gt;();   
  
  private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {                                          
      // TODO add your handling code here:
      txtaOutput.setText("");
      String word = txtfAdd.getText();
      list.add(word);
      for (int i = 0; i &lt; list.size(); i++) {
          txtaOutput.append("" + list.get(i) + "\n");
      }
  }
  
  private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {                                        
      // TODO add your handling code here:
      String user = txtfSearch.getText();
      txtaOutput.setText("");
      String index = Search.sequencial(list, user);
      txtaOutput.setText("" + index);
  }
  </code></pre>
  
  <p>Any help is appreciated!</p>