public SudokuFrame() { this.mainFrame = new JFrame("Sudoku"); this.p1JPanel = new JPanel(); this.p2JPanel = new JPanel(); this.newGameJButton = new JButton("Novo Jogo"); this.matrixSudokuFrame = new JTextFieldOnlyNumbers[9][9]; init(); sudokuController = new SudokuController(); sudokuController.setObserver(this); MatrixSudoku.getMatrixSudoku().generateRandomNumber(); }
private void setMatrix() { int matrix[][] = MatrixSudoku.getMatrixSudoku().getMatrix(); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (matrix[i][j] != 0) { this.matrixSudokuFrame[i][j].setText(String.valueOf(matrix[i][j])); if (initialize == 0) { this.matrixSudokuFrame[i][j].setEditable(false); initialize++; } } } } }