|
Java™ by example!
|
|
|
How do I create a password field?
Use the Swing class JPasswordField, a text component that doesn't display the characters as they are typed in but replaces them by an asterix ('*'). The echoed character that replaces the typed character can be set using the method setEchoChar. Notice that the method getText is deprecated as it makes use of Strings. The more secure way to get the password is through the 1.2 method getPassword that returns a character array. Main.java:
Further Information
Author of answer: Joris Van den Bogaert
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|