Java JPasswordField

The object of a JPasswordField class is a text component specialized for password entry. It allows the editing of a single line of text. It inherits JTextField class.

JPasswordField class declaration

Let's see the declaration for javax.swing.JPasswordField class.

public class JPasswordField extends JTextField

Commonly used Constructors:

Constructor Description
JPasswordField() Constructs a new JPasswordField, with a default document, null starting text string, and 0 column width.
JPasswordField(int columns) Constructs a new empty JPasswordField with the specified number of columns.
JPasswordField(String text) Constructs a new JPasswordField initialized with the specified text.
JPasswordField(String text, int columns) Construct a new JPasswordField initialized with the specified text and columns.

Java JPasswordField Example

Flash Soon


Java JPasswordField Example with ActionListener

Flash Soon



© Sapster 2017