private void logInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logInBtnActionPerformed
        try {
                     String username = usernameTxt.getText();
                     String password = passTxt.getText();
                     ResultSet loginResults = null;
                     Statement statement;                  
                     statement = connection.createStatement();
                     loginResults = statement.executeQuery( "SELECT * FROM User WHERE username='" + username +
                                                        "' AND password='" + password + "'");
                 
                     while (loginResults.next())
                    {
                        //finds any matching user and puts them into UserLoggedIn
                        UserLoggedIn = new User(loginResults.getInt("userID"), loginResults.getString("firstName"), 
                                loginResults.getString("surname"), loginResults.getString("username"), 
                                loginResults.getString("password"));
                    }              
                    if (UserLoggedIn == null )
                    {
                       JOptionPane.showMessageDialog(null, "Username or password not found. Please see your manager");
                    }              
                    else
                    {
                        newInstance.addUserLogedIn(UserLoggedIn);
                        int userID = UserLoggedIn.getUserID();
                        String role;
                        if (checkIfCLientRep(userID))
                            role = "Client Representative";
                        else
                            role = getUserRole(userID);
                        switch(role){ // load different starting frame depending on role

                            case "Manager": new ManagerUI().setVisible(true);
                                break;
                            case "QC Team Lead": new MainUI(userID).setVisible(true);
                                break;
                            case "QC Member":new MainUI(userID).setVisible(true);
                                break;
                            case "Product Architect":new MainUI(userID).setVisible(true);
                                break; 
                            case "Client Representative":new ClientRepUI(userID).setVisible(true);
                                break;     
                        }
                        this.setVisible(false);
                    }
        } catch (SQLException ex) {
            Logger.getLogger(LogInUI2.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_logInBtnActionPerformed