How to make if statement that checks if all or just one text field is empty

Kevin Medjiako :

How do I make an if statement which checks if all or just one text field is empty

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
    if(jTextField1.getText().equals("") && jTextField2.getText().equals("") && jTextField3.getText().equals("")){
            JOptionPane.showMessageDialog(null, " please fill empty fields", "Input Error",JOptionPane.ERROR_MESSAGE);
    }else{
    }
}
AnonRocketman :

What I did is listing all the Widgets with a "or" statement:

 if ((attribut1.isEmpty() || attribut2.isEmpty() || attribut3.isEmpty() || attribut4.isEmpty()||attribut5.isEmpty()||attribut6.isEmpty()||attribut7.isEmpty()||attribut8.isEmpty()||attribut9.isEmpty()||attribut10.isEmpty())) {
        Toast.makeText(this, "fill in all details"

Definitely not the nicest solution but it works.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=358890&siteId=1