TextField User Name Password Validation

TextField User Name Password Validation

After Button, the most used AWT component is TextField. TextField is useful to take input from the user and also to display output to the user by the programmer. User can write and edit the text in the TextField. Programmatically, the TextField can be made non-editable. Pressing Enter key generates ActionEvent and can be handled by ActionListener.

Limitations of TextField

One small limitation of TextField is it allows entering or displaying only one line of text; of course of any length. Anyhow, this limitation is overcome with TextArea, another AWT component.

Following is the class signature

public class TextField extends TextComponent

The super class of TextField is TextComponent and also for TextArea.

Example code on TextField User Name Password Validation

The following program comes with 3 text fields. In two text fields, user enters name and password. In the third text field, the programmer displays the result of validation.

TextField User Name Password Validation

4 thoughts on “TextField User Name Password Validation

  1. vinit

    I have a question , if I enter any value in textfied then I want another value will be come in another textfield based on previous text field. using awt frame in java
    and another question is how to add print facility on a button click .
    i have done printing work but it give low quality print ..

Leave a Reply
