Javatpoint Logo
Javatpoint Logo

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.

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


Java Jpasswardfield 1

Java JPasswordField Example with ActionListener


Java Jpasswardfield 2
Next TopicJava JCheckBox

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA