Search code examples
javaswinguser-interfaceinputpassword-protection

How to hide input in Java GUI


This question, Masking password input from the console : Java, addresses using the Console class to hide input as asterisks. How can this be done in a Swing GUI, where input is entered into a JTextArea, rather than the console?


Solution

  • You can Use this Swing component instead.

    JPasswordField

    http://docs.oracle.com/javase/7/docs/api/javax/swing/JPasswordField.html