title: Array of JPanels on a JFrame
body: <pre><code>public frame() {
     JFrame frame = new JFrame("Test");
     frame.setSize(400,300);
     frame.setLocationRelativeTo(null);
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     setLayout(new GridBagLayout());
     int i = 4;
     int j = 4;
     JPanel[][] panelHolder = new JPanel[i][j];
  
     for (int a = 0; a &lt; i; a++) {
         for (int b = 0; b &lt; j; b++) {
             panelHolder[a][b] = new JPanel();
             add(panelHolder[a][b]);
         }
     }
     panelHolder[3][2].setForeground(Color.BLUE);
     JButton enter = new JButton("Enter");
     panelHolder[0][0].add(enter);
  
     frame.setVisible(true);
  </code></pre>
  
  <p>When I try to add a component to a panel or set the color nothing changes, I used this code from elsewhere but I wrote it down the other day and can't find it again, but the loops are adding the JPanels to the frame right? so why can't I add to the JPanels?</p>