Setar

 public class Sudoku implements ActionListener{  
	 
     
	
    private JButton [][] botao = new JButton[9][9];  
    private JFrame janela = new JFrame("Sudoku");  
    private JPanel [] tabuleiro = new JPanel[9];  
      
   
    
    public Sudoku(){  
    	
       
       criarBotao();                       
       criarJanela();
       addValorBotao();
         
    }  
    
    

    
    public void criarBotao(){  
       for(int i = 0; i < botao.length; i++){  
          tabuleiro[i] = new JPanel(new GridLayout(3,3));  
          tabuleiro[i].setBorder(BorderFactory.createLineBorder(Color.black, 2)); 
          for(int j = 0; j < botao.length; j++){  
             botao[i][j] = new JButton();  
             botao[i][j].setText(""); 
             botao[i][j].addActionListener(this);  
             tabuleiro[i].add(botao[i][j]); 
                         
          }  
       }  
    }  
    
    
    
    public void criarJanela(){  
    	
       janela.getContentPane().setLayout(new GridLayout(3,3)); //SETANDO UM GRIDLAYOUT 3,3 NA JANELA
       for(int i = 0; i < tabuleiro.length; i++){   
          janela.getContentPane().add(tabuleiro[i]);  
       }   
       janela.setSize(400,400); //LARGURA, ALTURA   
       janela.setLocationRelativeTo(null); //CENTRALIZAR A JANELA
       janela.setResizable(false);  //PARA REDIMENSIONAR A JANELA
       janela.setVisible(true);     // PARA VISUALIZAR A JANELA
       janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
       
       
    }  
    
    
    
    
    
   
    public void addValorBotao(){
    	
       int[][] jogo =     {{9, 4, 0, 1, 0, 2, 0, 5, 8},
                           {6, 0, 0, 0, 5, 0, 0, 0, 4},
                           {0, 0, 2, 4, 0, 3, 1, 0, 0},
                           {0, 2, 0, 0, 0, 0, 0, 6, 0},
                           {5, 0, 8, 0, 2, 0, 4, 0, 1},
                           {0, 6, 0, 0, 0, 0, 0, 8, 0},
                           {0, 0, 1, 6, 0, 8, 7, 0, 0},
                           {7, 0, 0, 0, 4, 0, 0, 0, 3},
                           {4, 3, 0, 5, 0, 9, 0, 1, 2}};
    	
    	
       int[][] solucao =  {{9, 4, 7, 1, 6, 2, 3, 5, 8},
                           {6, 1, 3, 8, 5, 7, 9, 2, 4},
                           {8, 5, 2, 4, 9, 3, 1, 7, 6},
                           {1, 2, 9, 3, 8, 4, 5, 6, 7},
                           {5, 7, 8, 9, 2, 6, 4, 3, 1},
                           {3, 6, 4, 7, 1, 5, 2, 8, 9},
                           {2, 9, 1, 6, 3, 8, 7, 4, 5},
                           {7, 8, 5, 2, 4, 1, 6, 9, 3},
                           {4, 3, 6, 5, 7, 9, 8, 1, 2}};

        //SETANDO A MÃO O VALOR DE [i][j] posiçoes
    	//1QUADRANTE
        /*botao[0][0].setText("9");
        botao[0][1].setText("4");
        botao[0][3].setText("6");
        botao[0][8].setText("2");                
        // 2QUADRANTE
        botao[1][0].setText("1");
        botao[1][2].setText("2");
        botao[1][4].setText("5");
        botao[1][6].setText("4");
        botao[1][8].setText("3");                
        //3QUADRANTE
        botao[2][1].setText("5");
        botao[2][2].setText("8");
        botao[2][5].setText("4");
        botao[2][6].setText("1");               
        //4QUADRANTE
        botao[3][1].setText("2");
        botao[3][3].setText("5");
        botao[3][5].setText("8");
        botao[3][7].setText("6");              
        //5QUADRANTE
        botao[4][4].setText("2");              
        //6QUADRANTE
        botao[5][1].setText("6");
        botao[5][3].setText("4");
        botao[5][5].setText("1");
        botao[5][7].setText("8");               
        //7QUADRANTE
        botao[6][2].setText("1");
        botao[6][3].setText("7");
        botao[6][6].setText("4");
        botao[6][7].setText("3");            
        //8QUADRANTE
        botao[7][0].setText("6");
        botao[7][2].setText("8");
        botao[7][4].setText("4");
        botao[7][6].setText("5");
        botao[7][8].setText("9");    
        //9QUADRANTE
        botao[8][0].setText("7");
        botao[8][5].setText("3");
        botao[8][7].setText("1");
        botao[8][8].setText("2");*/

    }


public void actionPerformed(ActionEvent e){      	
       String x = "";  
       int numero;  
 
      
       for(int i = 0; i < botao.length; i++){  
          for(int j = 0; j < botao.length; j++){  
             if(e.getSource() == botao[i][j]){  
                do{  
                   numero = Integer.parseInt(JOptionPane.showInputDialog(null, "DIGITE O NÚMERO", "BOA SORTE!", JOptionPane.WARNING_MESSAGE));  
                   if(numero <= 0 || numero > 9){  
                      JOptionPane.showMessageDialog(null, "NUMERO INVÁLIDO DIGITE UM NUMERO DE 1 A 9", ">>>>>>>ATENÇÃO<<<<<<<", JOptionPane.WARNING_MESSAGE);  
                   }  
                }
                while(numero <= 0 || numero > 9);
                x = String.valueOf(numero); 
                botao[i][j].setText(x);   
              
                                  
             }
          }  
       }  
   }  
       
       
    
    
   
    public static void main(String args[]){  
    	Sudoku sudoku = new Sudoku();
           
    }  
} 

queria setar aquelas matriz “jogo” com alguns valores pré-definidos nos botoes, mas nao to conseguindo, eu tinha feito tudo na mão como deixei nos comentários, mas acho que assim fazendo desse jeito que fiz as duas matrizes, na hora de vericar ficaria mais fácil, não? como ficaria, fazer 1 for verificando se jogo é igual a solução se nao for, apontar erro, como? ;x

        for (int j = 0; j < jogo.length; j++) {
            for (int i = 0; i < jogo[0].length; i++) {
                if(jogo[j][i] != solucao[j][i]){
                    matrizDeErros[j][i] = true;
                }
            }
        }