DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  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!

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links