user1734885
user1734885

Reputation: 53

JPasswordField encoding the input

Java's JPasswordField is encoding the input which user enter in password field and I don't want it. I am checking password against database values which are purely numeric values.

Am entering the numeric values for password as

12345 

and it returns

[C@1e9b48b

Upvotes: 5

Views: 1789

Answers (2)

Timo Hahn
Timo Hahn

Reputation: 2496

The doc come with a sample http://docs.oracle.com/javase/tutorial/uiswing/components/passwordfield.html

The input is not 'encoded' but for each character you enter a special character is printed in the inout field.

Upvotes: -1

Austin
Austin

Reputation: 4929

I think when you mean encoding, you're probably trying to use the toString method. Which on a char array, will just use the standard object toString method.

Instead you could probably do

String password = new String(passwordField.getPassword());

The only other way it's "encoded" is if you're getting an encrypted password somehow.

Upvotes: 4

Related Questions