2016-04-11 13 views
-2

Açılan kutunun değeri seçili ise veya değil, ancak ikinci koşul doğru olduğunda açılan pencerede basit bir kontrol yapıyorum, herhangi bir bildirim gösterilmiyor ve ilk koşul doğru olduğunda bildirim burada gösteriliyor kodu.java düzgün çalışmıyorsa

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"); 
    } 
} 

Hata nedir, söyle bana. Teşekkür :) basitçe

+4

hata büyük olasılıkla sizin kodunuz düşünmek değerlerle çalışmıyor. hatırlıyorum: "" null – Stultuske

+0

ile aynı değil Kodunuzu hata ayıklayın ve anlayacaksınız. – Maroun

+1

test değerlerini. –

cevap

0
if(cboContactType.getValue() == null || cboContactType.getValue().equals("") || cboCountry.getValue() == null || cboCountry.getValue().equals("")){ 

Ya da sadece hata ayıklama (veya System.out.println ekleyin ("değer:" + cboContactType.getValue()); kodunuzu ve gerçek değeri görürsünüz