private void btnSubmit() {	
		
		Factory f = new Factory();
		try {
			String username = this.txtUsername.getText();
			Authentication a = Factory.createAuthentication();
			ArrayList<User> u = f.getUsers();
			System.out.println(username);
			//System.out.println(this.txtPassword.getPassword());
			if(a.authenticateUser(username, String.valueOf(this.txtPassword.getPassword()))){
				for(int i = 0; i < u.size(); i++){
					if(username.equals(u.get(i).getUsername())){
						loggedIn = u.get(i);
						if(u.get(i).isClient()){
							privilege = 0;
							log = true;
							break;
						}
						if(u.get(i).isTrainer()){
							privilege = 1;
							log=true;
							break;
						}
						if(u.get(i).isOwner()){
							privilege = 2;
							log=true;
							break;
						}
						}
					if(log == false){
						mainUI.logOut(this);
					}
					}
				}
			if(log == false){
				mainUI.logOut(this);
				loginError = new LoginErrorDialog(this);
				loginError.setVisible(true);
			}
			else{
				mainUI.switchUI(this);
			}
			}
			
		 catch (SQLException e) {
			e.printStackTrace();
			connectionError = new ConnectionErrorDialog(this);
			connectionError.setVisible(true);
		}

/*		switch (this.txtUsername.getText()) {
		case "user":
			privilege = 0;
			break;
		case "trainer":
			privilege = 1;
			break;
		case "owner":
			privilege = 2;
			break;
		default:
			break;
		}*/
	}