private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
 
        String name = username.getText();
        char [] pw  = passwordField.getPassword();
        String password = new String(pw);
        //System.out.println(password);

        
        try {
            ResultSet rset = Db.getData("SELECT * FROM users WHERE username='" + username.getText() + "'");
            if(rset.next()) {
//load table data and assign them to some Strings for the ease of use.

String u = rset.getString("username");
String p = rset.getString("password");
String c = rset.getString("classification");
String bannerid = rset.getString("bannerid");

if (u.equals(name) && p.equals(password)) {
//Correct username & login
    if(c.equals("S"))
    {
       activeStudent = new Student(bannerid);
        this.setVisible(false);

        Student newStudent = new Student(bannerid);
        newStudent.setBannerID(bannerid);

        //Student newStudent = new Student(bannerid);
        //newStudent.setBannerID(bannerid);


       studentForm form = new studentForm();
       form.setStudent(activeStudent);
       form.setVisible(true);
       
      
    }
    
    if(c.equals("F"))
    {
       Faculty activeFaculty = new Faculty(bannerid);
       ResultSet rset2 = Db.getData("SELECT * FROM faculty WHERE bannerid='" + bannerid + "'");
       if (rset2.next()){
           activeFaculty.setFirstName(rset2.getString("firstName"));
           activeFaculty.setLastName(rset2.getString("lastName"));
       }
       FacultyForm form = new FacultyForm();
       this.setVisible(false);
       form.setFaculty(activeFaculty);
       form.setVisible(true);
     //  dialog.setVisible(false);
    }
    

} else {
    JOptionPane.showMessageDialog(this, "wrong password!");
//Access Denied...
}
} else {
    JOptionPane.showMessageDialog(this, "Invalid username");
}
} catch (Exception e) {
    System.err.println(e);
}

    }//GEN-LAST:event_jButton1ActionPerformed