Sonntag, 28. Januar 2007

Get the password from JPasswordField

Problem:

"I have a problem with the JPasswordField. Every time Iwant to get the entered password using
passwordfield.getPassword() I just get something like [C@a32b.."

Solution:

JPasswordField doesn't return a String or a char. It returns a char array. To get your password as a string use this code:

String password = String.valueOf(passwordfield.getPassword());

Keine Kommentare: