knor
asked on
password hiding
I am trying to hide the text in a textbox with *** when a password is entered ... any ideas?
ASKER
a clearer view of what i am trying to do : i create a JTextField box that is associated with a password using this code
temp_FramerB = new PARTSFramer(1, 187.826f+ (1*1200), 1685.522f + (count*330), 2666.609f , 313.043f, 136);
((PARTSFramerLayout)this.g
this.getContentPane().add(
tBox.setVisible(true);
tBox.size();
parameter.addElement(tBox)
What i want to do is allow the user to enter his/her password but replace each character that is entered as a * ie hiding the password
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
tBox.setEchoChar('*');
Boycey19
Boycey19
The tBox.setEchoChar('*'); solution won't work as is. First the tbox must be a JPasswordField.
Check out:
http://web2.java.sun.com/products//jdk/1.3/docs/api/javax/swing/JTextField.html
It states:
"The method setEchoChar and getEchoChar are not provided directly to avoid a new implementation of a pluggable look-and-feel inadvertantly exposing password characters. To provide password-like services a seperate class JPasswordField extends JTextField to provide this service with an independantly pluggable look-and-feel."
AMD_MAN
ASKER
Great - it works a treat - =) Thanx
You are welcome!
AMD_MAN
<input type="password" name="textfield">