private void btnSetasSupervisorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSetasSupervisorActionPerformed
        int response;
        if(!(this.txtSupervisor.getText().equals(""))){
            response=JOptionPane.showConfirmDialog(null, "This project already has a supervisor. Are you sure to change the supervisor to new one?", "Replace Supervisor", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if(response==JOptionPane.YES_OPTION){               
                int row=tblEmployees.getSelectedRow();
                int empId= Integer.parseInt((String)tblEmployees.getModel().getValueAt(row, 0));
                try{
                    Statement st=con.createStatement();
                    st.executeUpdate("UPDATE supervisor SET emp_id="+empId+" WHERE pr_id="+GlobalVariables.temp_project_id);
                    System.out.println("Entry updated in the Supervisor table!");
                    this.txtSupervisor.setText((String)tblEmployees.getModel().getValueAt(row, 1));
                }
                catch(SQLException ex){
                    if(ex.getErrorCode()==1062){
                        JOptionPane.showMessageDialog(null, (String)tblEmployees.getModel().getValueAt(row, 1)+" is already a supervisor for another project. Choose another employee.", "Duplicate Entry", JOptionPane.ERROR_MESSAGE);
                    }
                } 
                catch(Exception ex){
                    ex.printStackTrace();
                }
            }

        }
        else{
            int row=tblEmployees.getSelectedRow();
            int empId= Integer.parseInt((String)tblEmployees.getModel().getValueAt(row, 0));
            try{
                Statement st=con.createStatement();
                st.executeUpdate("INSERT INTO supervisor VALUES ('"+empId+"','"+GlobalVariables.temp_project_id+"')");
                System.out.println("Entry inserted to the Supervisor table!");
                this.txtSupervisor.setText((String)tblEmployees.getModel().getValueAt(row, 1));
            }
            catch(SQLException ex){
                if(ex.getErrorCode()==1062){
                    JOptionPane.showMessageDialog(null, (String)tblEmployees.getModel().getValueAt(row, 1)+" is already a supervisor for another project. Choose another employee.", "Duplicate Entry", JOptionPane.ERROR_MESSAGE);
                }
            }
            catch(Exception ex){
                ex.printStackTrace();
            }
        }       
        
    }//GEN-LAST:event_btnSetasSupervisorActionPerformed