title: Leave small space between buttons when using GridLayout
body: <p>I am trying to create a toolbar that will go at the top of all the pages in my java swing application.</p>
  
  <p>I am creating a JPanel with a series of individual JPanels (containers) inside it. Each JPanel (container) has a north and south component or just a north component, set up using a GridLayout.</p>
  
  <p>My problem is, I want a small gap between the north and south component, but I can't see how to do it and have not been able to find any help on the internet.</p>
  
  <p>Below is a working example for the code for one of the containers:</p>
  
  <pre><code>public static void CustomersGui(){
  
          final JFrame frame = new JFrame("Nested Layout Example");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
          JPanel container1 = new JPanel();
          container1.setLayout(new GridLayout(2,1));
          JButton buttonDiary = new JButton("Diary");
          buttonDiary.setPreferredSize(new Dimension(140, 25));
          JButton buttonCars = new JButton("Cars");
          buttonCars.setPreferredSize(new Dimension(140, 25));
          container1.add(buttonDiary, BorderLayout.NORTH);
          container1.add(buttonCars, BorderLayout.SOUTH);
  
  
          frame.setContentPane(container1);
  
          frame.pack();
  
  
          frame.setVisible(true);
      }
  </code></pre>