1
I’m trying to put a kind of score counter on a Jlabel ex: you hit a question the score goes to 1 , you miss and nothing happens to the score.
I tried to do it that way :
private void confirmarActionPerformed(java.awt.event.ActionEvent evt) {
while (true){
String pont = " ";
int pontuacao = Integer.parseInt(pont);
if (confirmar == a){
a.setBackground(Color.green);
}else{
a.setBackground(Color.red);
}
}
}
Error:
Exception in thread "AWT-Eventqueue-0" java.lang.Numberformatexception: For input string: " "
The error is because you are trying to convert empty string to integer.
– user28595
Thanks again for helping me diego :D , well I ended up solving my problem ( very easy thing ) , I just created an int score = 0; took the while and put Pont.setText(" "+score);
– Ricardo66