title: How to get components of a JPanel which inside another JPanel in java
body: <p>I have a JPanel(first JPanel) and it fill with another JPanel(second JPanel).</p>
  
  <p>I add this second JPanel to first JPanel programmatically. Like below,</p>
  
  <pre><code>firstJPanel.removeAll();
  JPanel secondJPanel = new JPanel(gridLayout);
  secondJPanel.setBorder(new TitledBorder("Testing"));
  secondJPanel.setName("secondJPanel");
  firstJPanel.add(secondJPanel);
  firstJPanel.revalidate();
  </code></pre>
  
  <p>The second JPanel has some components like JTextFields , JCheckBoxes, etc . I try to get these components . But I could get only the second JPanel.</p>
  
  <p>Here is my code sample,</p>
  
  <pre><code>Component[] components = firstJPanel.getComponents();
  for(int i=0;i&lt;components.length;i++){
       System.out.println("Componenet name - " + components[i].getName());           
  }
  </code></pre>
  
  <p>Have any iedas to get the components inside the second JPanel.</p>
  
  <p>Best Regards.</p>