title: Java - GridLayout resize JPanel
body: <p>I'm trying to resize the height of each JPanel inside another JPanel which has a GridLayout.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>JPanel store = new JPanel();
  store.setLayout(new GridLayout(4, 0));
  
  JPanel computerPanel = new JPanel();
  computerPanel.setBorder(BorderFactory.createTitledBorder("Computers"));
  computerPanel.setPreferredSize(new Dimension(20, 30));
  
  JPanel cablesPanel = new JPanel();
  cablesPanel.setBorder(BorderFactory.createTitledBorder("Cables"));
  
  JPanel accessoriesPanel = new JPanel();
  accessoriesPanel.setBorder(BorderFactory.createTitledBorder("Accessories"));
  
  JPanel repairPanel = new JPanel();
  repairPanel.setBorder(BorderFactory.createTitledBorder("Repair"));
  
  store.add(computerPanel);
  store.add(cablesPanel);
  store.add(accessoriesPanel);
  store.add(repairPanel);
  
  JPanel view = new JPanel();
  view.setLayout(new BorderLayout());
  view.add(store, BorderLayout.CENTER);
  
  add(view);
  </code></pre>
  
  <p>This is what the GUI outputs: 
  <img src="https://i.stack.imgur.com/qryZk.png" alt="Screen shot"></p>
  
  <p>I want to resize each JPanel (computerPanel, cablelPanel, accessoriesPanel, repairPanel) inside the JPanel store.</p>
  
  <p>I have tried:</p>
  
  <p><code>computerPanel.setPrefferedSize()</code> but that doesn't work...</p>