title: JLabels to be resized in a GridLayout
body: <p>I have a very simple Java program (see below). The GridLayout has 20 rows and 4 columns. As you know the elements are supposed to be added horizontally by (GridLayout) definition. However, I get the two elements (labels) placed one above the other, vertically. </p>
  
  <p>I colored them and realised the labels take up the whole row, hence the vertical effect. But then I also used setSize(5,5) with each to make them smaller, however they still take up the whole row. Any advice as to why this happens and how to fix/set smaller size/etc?</p>
  
  <pre><code>public class Sam extends JFrame {
  
      public JButton btn_arr;
      public Container c;
      public JLabel[] lbl = new JLabel[20];
  
  
      public Sam()
      {
          c = getContentPane();
          c.setLayout(new GridLayout(20,4));
          lbl[1] = new JLabel("Column1");
          c.add(lbl[1]);
  
          lbl[2] = new JLabel("Column2");
          c.add(lbl[2]);
  
          show();     
      }
  
      public static void main(String[] args) 
      {
          Sam x = new Sam();
          x.setVisible(true);
          x.setSize(7500,4500);
      }
  
  }
  </code></pre>