title: Adjusting the height of a JPanel
body: <p><a href="https://i.stack.imgur.com/IWcpO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IWcpO.jpg" alt="enter image description here"></a>I have a top panel with a flow layout that has a textfield and label. I need to add more text fields and labels below the first line. I realized theres no real way of forcing a new line in flowlayout so I was just going to make a new panel and put it underneath the top one. The problem is theres a gap now because the top panels height is too tall. Is there a way to resize the panel so its width adjusts to screens automatically but I want to adjust the height of the new panel, so the gap is smaller. The two textfields up top are in the top panel with a flowlayout, The 3 textfields below are in a new panel with a flowlayout, is there a way to make the 3 textfields go right under the 2 textfields up top? Also, the whole frame is in a gridlayout.</p>
  
  <pre><code>frame.setLayout(new GridLayout(0,1));
  Static JPanel topPanel = new JPanel(new flowlayout);
  Static JPanel searchPanel = new JPanel(new flowlayout);
  Static JPanel statusPanel = new JPanel(new gridLayout(2,1));
  Static JPanel categoryPanel = new JPanel(new GridLayout(0.2));
  Static JPanel btnPanel = new JPanel(new GridLayout(0,3));
  frame.pack();
  topPanel.add(searchPanel);
  JPanel container2 = new JPanel(new BorderLayout()):
  container2.add(topPanel, BorderLayout.North);
  frame.getContentPane().add(container2);
  frame.getContentPane().add(statusPanel);
  frame.getContentPane().add(catergoryPanel);
  frame.getContentPane().add(btnPanel);
  </code></pre>