lundi 4 janvier 2016

A button in my app should only get the text in 8 text fields and send it to a table IF all fields are filled in

A button in my app gets all the text you enter in 8 text fields and sends it to a table. I need code so that you need to fill in ALL fields before you can send the info. How do I write the if statement?

This is the code for the add info button:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

    DefaultTableModel model = (DefaultTableModel) jTable1.getModel();

    model.addRow(new Object[]{jTextField1.getText(), jTextField2.getText(),
    jTextField3.getText(), jTextField4.getText(), jTextField5.getText(),
    jTextField6.getText(), jTextField7.getText(), jTextField8.getText()});
}

Aucun commentaire:

Enregistrer un commentaire