Results 1 to 4 of 4
Thread: How to replace typed characters?
- 05-22-2010, 07:10 AM #1
Member
- Join Date
- May 2010
- Posts
- 7
- Rep Power
- 0
How to replace typed characters?
Hello, my objective is simple:
I just want the display to output "*" for every character the user types in.
For example if he wants types "password" in the program the program displays "********".
I should mention im doing this in JCreator and not in a password field box, rather just the general output box it comes with.
Just incase it maybe relevent the code im trying to implement this idea is:
Thanks in advance.Java Code:import java.io.*; import java.util.Scanner; import java.util.Vector; public class MedicalOrganizer { public static void main(String[] args) { Scanner get = new Scanner (System.in); Vector strUser, strPassword; String strLoginU, strLoginP; boolean blnLogged = false; strUser = new Vector(); strPassword = new Vector(); System.out.println ("Login..."); while (blnLogged == false) { System.out.print ("\nUsername: "); strLoginU = get.next(); System.out.print ("Password: "); strLoginP = get.next(); int i = 0; try { DataInputStream uin = new DataInputStream(new FileInputStream("Usernames.ini")); DataInputStream pin = new DataInputStream(new FileInputStream("Passwords.ini")); while ((uin.available() != 0) && (pin.available() != 0)) { strUser.addElement(uin.readLine()); strPassword.addElement(pin.readLine()); if ((strLoginU.compareTo(String.valueOf(strUser.elementAt(i))) == 0) && (strLoginP.compareTo(String.valueOf(strPassword.elementAt(i))) == 0)) { blnLogged = true; } i++; } } catch (Exception e) { System.err.println (e); } if (blnLogged == false) { System.out.println ("\nIvalid username/password, please try again."); } } System.out.println ("\nAccess granted."); } }
- 05-22-2010, 07:39 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,385
- Blog Entries
- 7
- Rep Power
- 17
- 05-25-2010, 03:15 AM #3
Member
- Join Date
- May 2010
- Posts
- 7
- Rep Power
- 0
Thanks for the reply. I did look into the API just now, however I keep getting "Console not found" error.
- 05-25-2010, 03:50 AM #4
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
Similar Threads
-
is there anyway to replace java.IO
By nobody58 in forum Advanced JavaReplies: 1Last Post: 03-19-2010, 01:19 PM -
typed events vs untyped events.
By Drun in forum SWT / JFaceReplies: 0Last Post: 11-23-2009, 12:22 PM -
Replace String
By Raeghin in forum New To JavaReplies: 1Last Post: 07-28-2009, 03:58 PM -
First Typed via video instruction
By ZAXTHEGREAT in forum New To JavaReplies: 15Last Post: 07-23-2007, 04:27 PM -
Char type for first character typed?
By Sageinquisitor in forum New To JavaReplies: 3Last Post: 07-17-2007, 07:08 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks