I am wring a console java application,get user`s keybord input by System.in
. I want to know how hide the user`s input ,etc.password?
thanks.
Printable View
I am wring a console java application,get user`s keybord input by System.in
. I want to know how hide the user`s input ,etc.password?
thanks.
Try using the setEchoCharacter() method of class TextField
for example
TextField myText = new TextField(20);
myText.setEchoCharacter('*');
There's another method usable in subsequent versions of Java (beyond
1.02)...that's setEchoChar(char) --depending on which version you're
using.
Good luck
Brent
"past" <past@21cn.com> wrote:
>
>I am wring a console java application,get user`s keybord input by System.in
>. I want to know how hide the user`s input ,etc.password?
>thanks.
Thanks.but i donot want to use GUI.just console.
"Brent Horne" <bhorne@usa.net> wrote:
>
>Try using the setEchoCharacter() method of class TextField
>for example
>
>TextField myText = new TextField(20);
>myText.setEchoCharacter('*');
>
>There's another method usable in subsequent versions of Java (beyond
>1.02)...that's setEchoChar(char) --depending on which version you're
>using.
>
>Good luck
>Brent
>
>"past" <past@21cn.com> wrote:
>>
>>I am wring a console java application,get user`s keybord input by System.in
>>. I want to know how hide the user`s input ,etc.password?
>>thanks.
>
>
The console input comes with a readPassword() method, that should work to cover the users input. The info on it can be found here:
http://download.oracle.com/javase/6/docs/api/java/io/Console.html
Hope this helps!