Link to home
Start Free TrialLog in
Avatar of knor
knor

asked on

password hiding

I am trying to hide the text in a textbox with *** when a password is entered ... any ideas?
Avatar of bgillbanks
bgillbanks

This creates a password box called textfield... easy

<input type="password" name="textfield">
Avatar of knor

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.getContentPane().getLayout()).setFramer(tBox, temp_FramerB);
                                    this.getContentPane().add(tBox) ;
                                      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
Avatar of AMD_MAN
AMD_MAN

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
tBox.setEchoChar('*');

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
Avatar of knor

ASKER

Great - it works a treat - =) Thanx

You are welcome!

AMD_MAN