A few days ago some of my students asked me how to work with jPassword fields, at this moment I wasn’t sure how to do it, but this morning playing around with a little app I finally found it - really simple indeed -:

//how to read a password field
char[] auxiliar;
StringBuffer password = new StringBuffer();
auxiliar = jPasswordField1.getPassword();
for(int i=0; i<auxiliar.length; i++){
password.append(auxiliar[i]);
}
System.out.println(password.toString());

Happy Hacking!

Comparte esto con tus amigos:

Deja una Respuesta