title: Get all JTextField by order
body: <p>I use Netbeans to create GUI with a number of <code>JTextField</code> elements. I want iterate through all of them to call <code>setText</code>, the text will be just 1, 2, 3 ...</p>
  
  <pre><code>private javax.swing.JTextField txt1;
  private javax.swing.JTextField txt2;
  private javax.swing.JTextField txt3;
  private javax.swing.JTextField txt4;
  private javax.swing.JTextField txt5;
  private javax.swing.JTextField txt6;
  </code></pre>
  
  <p>I'm looking for a way to do this in a loop instead of calling <code>setText</code> by hand for each of them.</p>
  
  <p>May be something like that:</p>
  
  <pre><code>public void getInfoJText2(){
      Component[] children = jPanel1.getComponents();
      for (int i = 0, j = 1; i &lt; children.length; i++) {
          if (children[i] instanceof JTextField) {
              ((JTextField) children[i]).setText(Integer.toString(j++));
          }
      }
  }
  </code></pre>
  
  <p>How can I handle this?</p>