java - How to lock button for 30 seconds if incorrect username/password 3 times? -


this code have. reads text file , compares users input. have been trying add counter++ , once count =3 can't work. feel should easy....

boolean login = false;  while (read.nextline() !=null) {     string user = read.next();      string pass = read.next();      read.next();      if(usernamet.gettext().equals(user) && passwordt.gettext().equals(pass)) {         login = true;         break;                      } }  if (login) {     new menu(); } else {     joptionpane.showmessagedialog(null, "incorrect username or password");      usernamet.settext("");      passwordt.settext(""); } 

am thinking along write lines?

for(count=0;count<4){ if(login) new menu(); else { joptionpane.showmessagedialog(null, "incorrect  username or password"); usernamet.settext(""); passwordt.settext(""); count++  } }  

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -