how hide the input?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: how hide the input?

Hybrid View

  1. #1
    past Guest

    how hide the input?


    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.

  2. #2
    Brent Horne Guest

    Re: how hide the input?


    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.




  3. #3
    past Guest

    Re: how hide the input?


    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.

    >
    >



  4. #4
    Join Date
    Mar 2011
    Posts
    1
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center