title: Adding JPanels to JPanel array
body: <p>I have declared an array:</p>
  
  <pre><code>private javax.swing.JPanel[] panelArray = new javax.swing.JPanel[3];
  </code></pre>
  
  <p>I also have 3 panels: panel0, panel1 and panel2. Can I add these panels to the array? i.e</p>
  
  <pre><code>panelArray[0] = panel0;
  panelArray[1] = panel1;
  panelArray[2] = panel2;
  </code></pre>
  
  <p>And then manipulate the arrays like this?</p>
  
  <pre><code>boolean[] myBools; .... then set them as true/false
  for(int i=0; i&lt;3; i++)
  {
      if(myBools[i])
          panelArray[i].setVisible(true)
  }
  </code></pre>
  
  <p>Because that does not work for me</p>