title: Java jbutton in an arraylist, how can i know which one is clicked
body: <p>I have two arraylists with the same size, one for JButton, one for JTextField. When clicking the button, the corresponding textfield should be updated. How can I realize that? </p>
  
  <p>p.s. the number of jcomponents pairs (jbutton + jtextfield) are not fixed. They are designed  to be added or removed by the user. However, they have to be in the fixed order. </p>
  
  <pre><code>    ArrayList&lt;JButton&gt; buttonList = new ArrayList&lt;JButton&gt;();
      ArrayList&lt;JTextField&gt; textFieldList = new ArrayList&lt;JTextField&gt;();
  
      private JButton createButton(){
      JButton button = new JButton("Choose File");
      buttonList.add(button);
      button.addActionListener(
              new ActionListener(){
                  public void actionPerformed(ActionEvent event){
                      textField = textFieldList.get(i)
                      textField.setText("show updats");
                  }
              }       
      );      
      return button;
  }
  </code></pre>
  
  <p>How can I know the index "i" in the JButton ArrayList?</p>