@SuppressWarnings("deprecation")
protected void verifyInput(ActionEvent e) throws Exception {
char[] password1 = this.kDPasswordField1.getPassword();
char[] password2 = this.kDPasswordField2.getPassword();
//校验密码位数 均为6位
int length1 = password1.length;
int length2 = password2.length;
if(length1!=6||length2!=6){
MsgBox.showWarning(this, "密码输入格式要求均为6位数字,请重新输入!");
SysUtil.abort();
}
//校验密码1是否全部为数字
for (int i = 0; i < password1.length; i++) {
boolean digit = Character.isDigit(password1[i]);
if(!digit){
MsgBox.showWarning(this, "密码输入格式要求均为数字,请重新输入!");
SysUtil.abort();
}
}
//校验密码2是否全部为数字
for (int i = 0; i < password2.length; i++) {
boolean digit = Character.isDigit(password2[i]);
if(!digit){
MsgBox.showWarning(this, "密码输入格式要求均为数字,请重新输入!");
SysUtil.abort();
}
}
//校验密码是否一致
if(!Arrays.equals(password1, password2)){
MsgBox.showWarning(this, "密码输入不一致,请重新输入!");
SysUtil.abort();
}
}