public MainGUI() {
		super("Sudoku");
		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		setSize(new Dimension(500, 550));

		board = new JPanel(new GridLayout(3, 3));
		boxes = new JPanel[3][3];
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				boxes[i][j] = new JPanel(new GridLayout(3, 3));
				boxes[i][j].setBorder(BorderFactory
						.createLineBorder(Color.black));
				board.add(boxes[i][j]);
			}
		}

		cells = new JTextField[9][9];

		for (int hShift = 0; hShift < 3; hShift++) {
			for (int vShift = 0; vShift < 3; vShift++) {
				for (int i = 0; i < 3; i++) {
					for (int j = 0; j < 3; j++) {
						int m = i + 3 * hShift;
						int n = j + 3 * vShift;
						cells[m][n] = new JFormattedTextField();
						cells[m][n].addKeyListener(new KeyListener() {
							public void keyReleased(KeyEvent ke) {
								JTextField jtf = (JTextField) ke.getComponent();
								String str = jtf.getText().trim();
								int i = 0;
								try {
									i = Integer.parseInt(str);
								} catch (NumberFormatException e) {
									jtf.setText("");
								}
								if (i < 1 || i > 9) {
									jtf.setText("");
								}
							}

							public void keyPressed(KeyEvent ke) {
							}

							public void keyTyped(KeyEvent ke) {
							}
						});
						cells[m][n].setFont(font);
						cells[m][n].setHorizontalAlignment(JTextField.CENTER);
						boxes[hShift][vShift].add(cells[m][n]);
					}
				}
			}
		}

		add(board, BorderLayout.CENTER);

		control = new JPanel();
		solve = new JButton("Solve");
		solve.addActionListener(this);
		control.add(solve);
		step = new JButton("Step");
		step.addActionListener(this);
		control.add(step);
		clear = new JButton("Clear");
		clear.addActionListener(this);
		control.add(clear);
		imp = new JButton("Import");
		imp.addActionListener(this);
		control.add(imp);
		analyze = new JButton("Analyze");
		analyze.addActionListener(this);
		control.add(analyze);
		add(control, BorderLayout.PAGE_END);
		setVisible(true);
	}