0
Can anyone guide me is there password masking in java(eclipse) if there is any possibility then plz share with me
I want to make a program in which a use enter a password and it become staric
7 Respostas
+ 2
It sounds like you're making a graphical user interface using Java's AWT or swing packages and want a text input component that hides the characters from someone looking over your shoulder. It sounds like you want the Java swing equivalent to <input type="password">.
You want to use JPasswordField.
The class is documented here:
https://docs.oracle.com/javase/7/docs/api/javax/swing/JPasswordField.html
How to use it with examples is explained here:
https://docs.oracle.com/javase/tutorial/uiswing/components/passwordfield.html
+ 2
Run this on your PC. Both username and password is kept as admin.
https://code.sololearn.com/cA10a4a10A10/?ref=app
+ 1
Just in case if it's a basic command line application, then you can use the "readPassword()" from the "Console" class.
But this will not turn the password to * and will only hide it so that it's not displayed.
+ 1
Use Avinesh's answers then.
Here is a page with examples too:
https://www.javatpoint.com/java-console-readpassword-method
Hopefully you get better at using google to search for things like that soon because it'll speed you up lots more than asking and waiting for answers from people like us.
You'll find lots of information by searching "java Console readPassword".
0
Avinesh bro thanks for your valuable comment, but i am not able to make full code of it can you share code with me
Its himble request
0
Josh Greig no man i am just asking about command line
0
Thank you buddy