1
my colleagues good night,  I made a game of mathematician.
random numbers can show it on the interface, but it does not compare the user number with the programmed results
I can’t make a comparison.
If I put the number only to appear on the screen, he drew the number , but not on the console.
private void verificarResultadoActionPerformed(java.awt.event.ActionEvent evt){ 
    Random rand = new Random();
    int numero1 = rand.nextInt(2)+2 ;
    int numero2 = rand.nextInt(9)+2 ;
    int resultprogramado = (numero1*numero2);
    int respUsuario = Integer.parseInt(respostaUsuario.getText());
    if ( respUsuario == resultprogramado) {
        System.out.printf("Resposta certa!%n  %d x %d = %d", numero1, numero2, (numero1 * numero2));   
    } else {
        System.out.printf("Resposta errada!%n  %d x %d = %d", numero1, numero2, (numero1 * numero2)); 
    }
    gerarNovaOperacao();
}
private void gerarNovaOperacao() {
    Random rand = new Random();
    int numero1 = rand.nextInt(2)+2 ;
    int numero2 = rand.nextInt(9)+2 ;
    int resultprogramado = numero1 * numero2;
    telaX.setText(numero1+ "x" +numero2);
    respostaUsuario.setText("");
    respostaUsuario.requestFocus();
}       
						
A small optimization: instead of
new Integer(resultprogramado)preferInteger.valueOf(resultprogramado).– Piovezan