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 -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -