title: Swing gui not displaying, but no errors?
body: <p>I am working on a java program that solves sudoku puzzles. So far all I have coded is a class that draws the board with swing, and another class that calls the gui class.</p>
  
  <p>When I try and run the program nothing happens. No error messages are shown, but the gui doesn't show either. It immediately terminates.</p>
  
  <p>Here is my code so far:</p>
  
  <p>Gui class:</p>
  
  <pre><code>package sudoku;
  
  import java.awt.*;
  import javax.swing.*;
  
  public class Gui {
  
      Gui gui;
      JPanel board;
      JPanel subBoard[][];
      GridLayout layout;
      JLabel square[][];
  
      public void load() {
  
          gui = new Gui();
          gui.setUp();
          gui.buildBoard();
  
      }
  
      private void setUp() {
  
          layout = new GridLayout(3, 3);
          board = new JPanel(layout);
          subBoard = new JPanel[3][3];
          square = new JLabel[9][9];
  
      }
  
      private void buildBoard() {
  
          // set up board
          board.setSize(800, 600);
          board.setVisible(true);
  
          int mod = 0;
          for (int i = 0; i &lt; 3; i++) {
              for (int j = 0; j &lt; 3; j++) {
  
                  // add subBoards to board
                  subBoard[i][j] = new JPanel();
                  board.add(subBoard[i][j]);
                  subBoard[i][j].setLayout(layout);
                  subBoard[i][j].setVisible(true);
  
                  // add textfields to each subBoard
                  square[i + mod][j + mod] = new JLabel();
                  subBoard[i][j].add(square[i + mod][j + mod]);
                  square[i + mod][j + mod].setVisible(true);
  
              }
              mod += 3;
  
          }
      }
  
  }
  </code></pre>
  
  <p>main class:</p>
  
  <pre><code>package sudoku;
  
  public class SudokuSolver {
  
      public static void main(String[] args) {
  
          Gui gui = new Gui();
          gui.load();
  
      }
  
  }
  </code></pre>
  
  <p>I tried running it in both eclipse and netbeans but got the same result both times. Why does this not work?</p>