JTextField, check field

78 Views Asked by At

My intent is programming a java applet form, whit connection in a database. when the user compile field, how can check the input while compile and show if exist in a database?

example: Username: myuser. near the jtextfield a label status notify if the test exist in the database. the control need check when the user have finish compile field and not when click on the button. how a control strenght of password. its possibile?

1

There are 1 best solutions below

2
On

You can control the weight of the password by using JPassword class, and making a boolean method that validates the password length doesn't exceed a certain length. For example:

public boolean checkPassword()
{
    private JPassword password;

    if (password.length >= 20) // checking if the password is greater or equal 20
    {
        throw new IllegalArgumentException;
        System.exit(1);
    }
    else
        return password;
}