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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -