if (jTextFieldUserName.getText() .isEmpty())
{
JOptionPane.showMessageDialog(new JFrame(), "Enter the User Name", "Dialog", JOptionPane.ERROR_MESSAGE);
}
else if(jTextFieldType.getText() .isEmpty()){
JOptionPane.showMessageDialog(new JFrame(), "Enter the Type", "Dialog", JOptionPane.ERROR_MESSAGE);
}
else if(jTextFieldPassword.getText() .isEmpty()){
JOptionPane.showMessageDialog(new JFrame(), "Enter the Password", "Dialog", JOptionPane.ERROR_MESSAGE);
}
else if(jTextFieldConfirmPassword.getText() .isEmpty()){
JOptionPane.showMessageDialog(new JFrame(), "Enter the ConfirmPassword", "Dialog", JOptionPane.ERROR_MESSAGE);
}
else if(jTextFieldPassword.equals(jTextFieldConfirmPassword)){
JOptionPane.showMessageDialog(this, "Mismatch", "Success", JOptionPane.INFORMATION_MESSAGE);
}
else{
NewUser obj=new NewUser();
obj.setUserName(jTextFieldUserName.getText());
obj.setPassword(jTextFieldPassword.getText());
obj.setConfirmPassword(jTextFieldConfirmPassword.getText());
obj.setType(jTextFieldType.getText());
JOptionPane.showMessageDialog(this, "New user created", "Success", JOptionPane.INFORMATION_MESSAGE);
try{
obj.addUsers(obj);
} catch (Exception ex) {
System.out.println(" "+ex.toString());
}
}
我不知道哪里出错了。我希望我使用了正确的字符串。我没有得到" Mismatch"我正在获得"新用户创建"它正被保存到数据库中。请帮帮我。