我正在对组合框进行简单的检查,如果选择了组合框的值,但是当第二个条件为真时则没有显示通知,当第一个条件为真时,此处显示的通知就是代码。
if(cboContactType.getValue() == null || cboCountry.getValue() == null){
Notification.show("Contact type and country can't be empty");
} else if(cboContactType.getValue().equals("Email")) {
if(txtEmail.getValue() == null) {
Notification.show("Email can'nt be empty");
}
}
告诉我这是什么错误。谢谢:))
答案 0 :(得分:0)
if(cboContactType.getValue() == null || cboContactType.getValue().equals("") || cboCountry.getValue() == null || cboCountry.getValue().equals("")){
或者只是调试(或者只是将System.out.println("值为:" + cboContactType.getValue());添加到您的代码中,您将看到真正的价值