I have a JTextField
. The same JTextField
will be used to get both name and password of the user. So if it's getting the username, I would display what the user is typing on the Text field. But if he's inserting a password, the field should not display the password (but display * characters instead).
How can I make a JTextField hide the characters that he/she types ?
Pseudocode :
If (usernameBool!=true) {
// Display normal text - user is able to see the password
} else {
// This is going to be a password field, so i need to not show the password to the user instead show it as ******* instead.
}
Note: I don't want to use JPasswordField
for this