/**
   * Validates that inputted info is correct, resets password info in database resets textfields to
   * empty string ""
   *
   * @throws SQLException throws exception if connection could not be made
   */
  public void Validator() throws SQLException {
    update.setText("");
    setUser(UsersConnection.getInfo(username.getText(), emailf.getText(), 5));
    boolean validInfo = true;
    String emailinfo = new String(emailf.getText());
    if (emailinfo.equals("")) {
      emailWrong.setText("<html>*You must enter email to<br>update your password<html/>");
      validInfo = false;
    } else if (!emailinfo.equals(u.getEmail())) {
      System.out.println("here!");
      emailWrong.setText("*Wrong email");
      validInfo = false;
    } else emailWrong.setText("");

    String passinfo1 = new String(password1.getPassword());
    if (!passinfo1.equals("") && passinfo1.length() < 4) {
      pass1Wrong.setText("Password must at least 4 charactor");
      validInfo = false;
    } else pass1Wrong.setText("");
    String passinfo2 = new String(password2.getPassword());

    if (passinfo2.equals(passinfo1)) pass2Wrong.setText("");
    else {
      pass2Wrong.setText("*Password does not match");
      validInfo = false;
    }

    if (validInfo) {
      if (!passinfo1.equals("")) u.setPassword(passinfo1);
      init();
      update.setText("Your information is up-dated");
      emailWrong.setText("");
    }
  }
 /**
  * Test fucntion
  *
  * @param args main arguments
  * @throws SQLException if connection could not be made
  */
 public static void main(String[] args) throws SQLException {
   JFrame window = new JFrame();
   ForgotUser frame = getUserPanel();
   frame.init(connection.userInfo.UsersConnection.getInfo(8));
   window.setContentPane(frame);
   window.setSize(1080, 720);
   window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   window.setVisible(true);
 }