我的目的是编写一个java applet表单,在数据库中使用whit连接。 当用户编译字段时,如何在编译时检查输入并显示是否存在于数据库中?
例如: 用户名:myuser。在jtextfield附近,标签状态通知数据库中是否存在测试。当用户完成编译字段而不是单击按钮时,控件需要检查。如何控制密码的强度。 它可能吗?
答案 0 :(得分:-1)
您可以使用JPassword
类来控制密码的权重,并使用于验证密码长度的布尔方法不会超过一定长度。例如:
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;
}