Home > Net >  How to show the word password masked in the password field?
How to show the word password masked in the password field?

Time:10-16

enter image description here

I want to have a registration form where the label parts of the username or password will be in the text field and password field but in the password field it will be hidden. Can anyone help me? .. on Netbeans, Winform ex: form Login facebook. I want the same username and password

CodePudding user response:

Use the JPasswordField function jPasswordField.getPassword();

to get the password as char[] .

Use jPasswordField1.setEchoChar('*') to mask the password characters with *.

If you wish to see the value you are inserting use

  jPasswordField1.setEchoChar((char)0); 

Setting a value of 0 indicates that you wish to see the text as it is typed, similar to the behavior of a standard JTextField.

  • Related