Reputation: 255
When we enter password in any account the characters are not shown to us. I created a JTextField whose label is "password". What can I do so that when I enter characters in this JTextField they are shown like "***********"
?
Upvotes: 2
Views: 4440
Reputation: 71
Use JPasswordField but you can use this code to convert Char to String;
String password = String.valueOf(jPasswordField.getPassword());
Upvotes: 0
Reputation: 33544
I think the solution to the problem is using JPasswordField
See this documentation:
http://docs.oracle.com/javase/6/docs/api/javax/swing/JPasswordField.html
See these tutorials:
www.java2s.com/Tutorial/Java/0240_Swing/0300_JPasswordField.htm
Upvotes: 3