private void checkUserPasswordAndRole(String user, String password) {
		ArrayList<String> logins = new ArrayList<String>();
		ArrayList<String> passwords = new ArrayList<String>();
		ArrayList<String> roles = new ArrayList<String>();
		
		for(int i = 0; i<table.getRowCount();i++) {
			logins.add((String)table.getValueAt(i, 1));
			passwords.add((String)table.getValueAt(i,2));
			roles.add((String)table.getValueAt(i, 3));
		}
		
		if(logins.contains(user)) {
			if(passwords.get(logins.indexOf(user)).equals(password)) {
				JOptionPane.showMessageDialog(frame,
					    "Uzytkownik zalogowany",
					    "Sukces.",
					    JOptionPane.INFORMATION_MESSAGE);
				
				
				switch(roles.get(logins.indexOf(user))) {
					case "ADMIN": users.loginAdmin();break;
					case "CLERK": users.loginClerk(); break;
					case "SERVICE":users.loginService(); break;
					default: {
						System.out.println("Blad przy ustawianiu uprawnien");
					}
				}
			}
			else {
				JOptionPane.showMessageDialog(frame,
					    "Bledne haslo uzytkownika.",
					    "Blad logowania.",
					    JOptionPane.ERROR_MESSAGE);
			}
			
		}
		else {
			JOptionPane.showMessageDialog(frame,
				    "Nie znaleziono uzytkownika.",
				    "Blad logowania.",
				    JOptionPane.ERROR_MESSAGE);
		}
	}