title: Get location of a swing component
body: <p>I have put some JPanels into another JPanel which its' layout is Box Layout and Y-Axis.
  After I have put all the panels I need to get the Y position of each added JPanel in from the JPanel container panel. But, when I try to get that I always get zero for Y position of each JPanel. Please tell me how to get the Y position of each Jpanel from the JPanel container JPanel.</p>
  
  <p>This is what I have done,</p>
  
  <pre><code>JPanel panelHolder = new JPanel(new BoxLayout(this, BoxLayout.Y_AXIS));
  for(int i = 0; i&lt; 10; i++){
     JPanel p = new JPanel(); 
     panelHolder.add(p);
  }
  
  int componentCount = panelHolder.getComponentCount();
  
  for (int j = 0; i &lt; componentCount ; j++) {
  
    Component c = pnlRowHolder.getComponent(i);
    JPanel p = (JPanel)c;
    System.out.println(p.getY());//I get zero for all
  }
  </code></pre>