title: How to use grid or box layouts effectively? (Correctly?)
body: <p>How to use grid or box layout to correctly display information? (Ex. 5 students/rows, 3 grades/cols)</p>
  
  <p>I have tried a grid layout, which worked well. However, it did not follow my rows/columns that I specified. I messed around with things such as using a box layout panel containing several grid layout panels. I've undone everything and now I'm back at square one. I now ask you for help.</p>
  
  <pre><code>Student: Test #1: Test #2: Test #3:
  Name     100      50       75
  Name     100      50       75
  Name     100      50       75
  Name     100      50       75
  Name     100      50       75
  etc...
  </code></pre>
  
  <p>^example of what I'm trying to achieve^</p>
  
  <p>A bit more on what I said earlier, after about 2-3 rows/students, the layout changed and split the grades like such:</p>
  
  <pre><code>Student: Test #1: Test #2: Test #3:  Name     100   75   25
  Name     100      50       75        Name     75    20   10
  Name     50       75       100       Name     100   40   32
  </code></pre>
  
  <p>If you have any ideas, please let me know.</p>
  
  <p>Code:</p>
  
  <pre><code>public class GradesPanel extends JPanel
  {
  
  
  //Constructor
  public GradesPanel()
  {
  
      final int STUDENTS = 5;
      final int GRADES = 3;
  
      JTextField[] gradeField = new JTextField[GRADES];
      JPanel[] gradePanel = new JPanel[GRADES];
      JLabel[] gradeLabel = new JLabel[GRADES];
      JLabel[] header = new JLabel[GRADES + 1];
      JLabel[] nameLabel = new JLabel[STUDENTS];
  
      JPanel outerPanel = new JPanel();
      outerPanel.setLayout(new BorderLayout());
  
      JPanel innerPanel = new JPanel();
      innerPanel.setLayout(new GridLayout(STUDENTS, GRADES));
  
      //Create headers
  
      header[0] = new JLabel("Student:");
      innerPanel.add(header[0]);
      for(int col = 1; col &lt; (GRADES+1); col++)
      {   
          header[col] = new JLabel("Test #" + (col));
          innerPanel.add(header[col]);
      }
  
  
      //Create Label/TextField for each student/grade
      for(int row = 0; row &lt; STUDENTS; row++)
      {
          nameLabel[row] = new JLabel("Name");
          innerPanel.add(nameLabel[row]);
          for(int col = 0; col &lt; GRADES; col++)
          {   
              //gradeLabel[col] = new JLabel("");
              gradeField[col] = new JTextField(3);
              //innerPanel.add(gradeLabel[col]);
              innerPanel.add(gradeField[col]);
          }
      }
  
      //outerPanel.setPreferredSize(new Dimension(300,100));
      //outerPanel.add(innerPanel, BorderLayout.CENTER);
      //add(outerPanel);
      add(innerPanel);
  }   
  }
  </code></pre>