Change echo char in JPasswordField - Java Swing

Java examples for Swing:JPasswordField

Introduction

You can set an echo character using the setEchoChar() method as follows:

// Set # as the echo character
password.setEchoChar('#');

You can use a JPasswordField as a JTextField by setting its echo character to zero as follows:

// Set the echo character to 0, so the actual password characters are visible.
passwordField.setEchoChar((char)0);

Related Tutorials