title: Adding a JLabel above a GridLayout
body: <p>I'm having a hard time with containing a GridLayout so that adding a JLabel above it won't throw off anything. I've tried a few different things but still cant seem to get it aligned right. </p>
  
  <p>It's a Tic Tac Toe game:</p>
  
  <pre><code>package assg01;
  import javax.swing.*;
  import java.awt.*;
  import java.awt.event.*;
  
  public class TicTacToe extends JFrame {
     private static final String TITLE = "Tic Tac Toe";
     private static final int WIDTH = 700;
     private static final int HEIGHT = 808;
     private Container content;
     private JLabel result;
     private JButton[] cells;
     private JButton exitButton;
     private JButton initButton;
     private CellButtonHandler[] cellHandlers;
     private ExitButtonHandler exitHandler;
     private InitButtonHandler initHandler;
     private boolean noughts;
     private boolean gameOver;
     private Container panel;
     private ImageIcon x,empty,o;
  
     public TicTacToe() {
      // Necessary initialization code
         setTitle(TITLE);
         setSize(WIDTH, HEIGHT);
         setDefaultCloseOperation(EXIT_ON_CLOSE);
         // Get content pane
         panel = getContentPane();
         //content.setBackground(Color.blue.darker())
         // Set layout
         panel.setLayout(new GridLayout(3, 3, 5, 5));
         // Create cells and handlers
         cells = new JButton[9];
         cellHandlers = new CellButtonHandler[9];
         for (int i = 0; i &lt; 9; i++) {
             cells[i] = new JButton();
             cellHandlers[i] = new CellButtonHandler();
             cells[i].addActionListener(cellHandlers[i]);
         }
         // Create result label
         //result.setForeground(Color.white);
         // Add elements to the grid content pane
         for (int i = 0; i &lt; 9; i++) {
             panel.add((cells[i]));
         }      
         init();
     }
     public void init() {
         // Initialize
  
        JPanel topPanel = new JPanel();
        add(topPanel,BorderLayout.NORTH);
          JLabel myLabel = new JLabel ("Label") ;
          topPanel.add(myLabel);
  
         x=new ImageIcon("images/x.png");
         empty=new ImageIcon("images/empty.png");
         o=new ImageIcon("images/o.png"); 
         noughts = true;
         gameOver = false;
         // Initialize text in buttons
         for (int i = 0; i &lt; 9; i++) {
             char ch = (char) (i + 1);
             cells[i].setIcon(empty);
             cells[i].setName(""+ch);
         }
         // Initialize result label
         setVisible(true);
     }
  </code></pre>