I have a JButton that updates data in my MYSQL database, how do i enable the JButton only when there are changes detected in my JTextFields?
...this is my code for the update button
private void updateBtnActionPerformed(java.awt.event.ActionEvent evt) {
try{
String a = IDField.getText();
String query = "UPDATE employee SET First_Name=?, Last_Name=?,Job_Title=? WHERE ID=?";
PreparedStatement ps = conn.prepareStatement(query);
ps.setString(1, FNameField.getText());
ps.setString(2, LNameField.getText());
ps.setString(3, jobTitleField.getText());
ps.setString(4, a);
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Successfully Updated Employee Record!");
}catch(Exception e){
System.out.println(e);
}