title: Multiple panels in JFrame
body: <p>The useless Layout Manager guy is back again, I just can't seem to get my head around these darn layouts and make them work the way I want.</p>
  
  <p>Anyway, I want to have a JFrame which has one large panel at the top (I call it a header) which runs from the left to right side of the frame at the north part of the frame, then four panels below it, two just below the header and two below those, and finally a "footer" panel, basically the same as the header panel, only at the south part of the frame.</p>
  
  <p>Like this:</p>
  
  <p><img src="https://i.stack.imgur.com/XPQeA.png" alt="UI Design."></p>
  
  <p>I had code which had the four middle panels working fine, but the header panel just messed everything up, and I have since been testing with the demo layout manager code for GridBagLayout, GridLayout again and BoxLayout. I can't getting any to work as I want.</p>
  
  <p>For the aware of you here, you will probably notice I've already had a question related to this, and if having two similar questions are not allowed, please make me aware and I will move this to my previous question and this can be closed.</p>
  
  <pre><code>public Shop() {
          shopUI = new JFrame("Shop Menu");
          shopUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          shopUI.setBounds(100, 100, 700, 500);
          shopUI.setResizable(false);
  
          allPanels = new JPanel();
  
          headerPanel = new JPanel();
          headerPanel.setLayout(new BorderLayout());
          headerPanel.setBackground(Color.cyan);
  
          mainPanel = new JPanel();
          mainPanel.setLayout(new GridLayout(2,2));
  
          topLeft = new JPanel();
          topLeft.setBackground(Color.pink);
  
          topRight = new JPanel();
          topRight.setBackground(Color.black);
  
          bottomLeft = new JPanel();
          bottomLeft.setBackground(Color.green);
  
          bottomRight = new JPanel();
          bottomRight.setBackground(Color.blue);
  
          footerPanel = new JPanel();
          footerPanel.setLayout(new BorderLayout());
          footerPanel.setBackground(Color.magenta);
  
          mainPanel.add(topLeft);
          mainPanel.add(topRight);
          mainPanel.add(bottomLeft);
          mainPanel.add(bottomRight);
  
          allPanels.add(headerPanel, BorderLayout.NORTH);
          allPanels.add(footerPanel, BorderLayout.SOUTH);
          allPanels.add(mainPanel);
  
          shopUI.add(allPanels);
  
          shopUI.setVisible(true);
  }
  </code></pre>