Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How can I validate the text entered when I add/update the information? For examp

ID: 3833028 • Letter: H

Question

How can I validate the text entered when I add/update the information? For example, I need to verify input, and return if anything is invalid or missing Verify hire date is before leave date verify phone number is entered correctly

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

//create Data table object and set it to match employee table
DefaultTableModel model=(DefaultTableModel) jTable_EmployeeTable.getModel();


if(!jTextField_EmplyID.getText().trim().equals("")){
//create row object and add data into object

Object[]newRowData={jTextField_EmplyID.getText(),jTextField_LastName.getText(),jTextField_FirstName.getText(),jComboBox_Gender.getSelectedItem(),jTextField_Phone.getText() ,jTextField_Email.getText(), jDateChooser_HireDate.getDate(), jDateChooser_EndDate.getDate()};
//add row to table for display
model.addRow(newRowData);
//clear data
jTextField_EmplyID.setText("");
jTextField_LastName.setText("");
jTextField_FirstName.setText("");
jTextField_SSN.setText("");
jTextField_Phone.setText("");
jTextField_Email.setText("");



}
else{
Message.setText("Employee ID should not be left blank");
}


I don't know how to validate all answers before adding a row to the JTable

Explanation / Answer

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote