Results 1 to 7 of 7
  1. #1
    terrytran is offline Member
    Join Date
    Jun 2011
    Posts
    5
    Rep Power
    0

    Default Ready to Program JAVA - passwords

    Hey guys i was wondering if there was a way to code the way a user would enter in a password and not see what they are typing.

    for example:

    String password;

    c.println ("Please enter in your password");
    c.setCursor (10, 10);
    password=c.readString ();


    now if you were to use this code, you'd be able to see yourself typing in the password. is there a way to make it so you cannot see? Like when you type it there would be dots or whatever?

    thanks in advance!

  2. #2
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

    Default

    rather than a string try using a JPasswordField and then you can set the "echo charecter" which is what the actual password is visually replaced with when typing
    check this out for more details about its methods etc: JPasswordField

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,422
    Rep Power
    20

    Default

    What class is c in your code? Recommended reading: How to ask questions the smart way

    db

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,422
    Rep Power
    20

    Default

    Quote Originally Posted by littledrummerboy View Post
    rather than a string try using a JPasswordField and then you can set the "echo charecter" which is what the actual password is visually replaced with when typing
    check this out for more details about its methods etc: JPasswordField
    The OP hasn't yet reached programming a GUI.

    db

  5. #5
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

    Default

    Quote Originally Posted by DarrylBurke View Post
    The OP hasn't yet reached programming a GUI.

    db
    What does OP stand for?

  6. #6
    mine0926 is offline Senior Member
    Join Date
    Apr 2010
    Location
    Philippines
    Posts
    580
    Rep Power
    5

    Default

    Original post or Original Poster.

  7. #7
    Join Date
    May 2011
    Location
    Maryland
    Posts
    38
    Rep Power
    0

Similar Threads

  1. Replies: 4
    Last Post: 03-09-2011, 11:30 PM
  2. Replies: 1
    Last Post: 03-29-2010, 01:07 AM
  3. [SOLVED] Ready to Program Java IDE
    By Starr29 in forum New To Java
    Replies: 9
    Last Post: 07-24-2009, 05:21 PM
  4. Ready to Program Java IDE Problem #4
    By Starr29 in forum New To Java
    Replies: 5
    Last Post: 01-06-2009, 03:38 PM
  5. [SOLVED] Ready to Program Java IDE Problem #2
    By Starr29 in forum New To Java
    Replies: 2
    Last Post: 01-03-2009, 01:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •