Advertisement
Guest User

Untitled

a guest
Jan 25th, 2017
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. boolean flag = false;
  2. Scanner fileInput = new Scanner(new File("Account"));
  3. BufferedReader br = new BufferedReader(new FileReader("Account"));
  4. if (br.readLine()==null){
  5. JOptionPane.showMessageDialog(frame, "Record is empty! Please register an account!");
  6. new Registration();
  7. frame.setVisible(false);
  8. }
  9. else{
  10. while(fileInput.hasNextLine()){
  11. String user = fileInput.nextLine();
  12. String pass = fileInput.nextLine();
  13. if (a.equals(user) && b.equals(pass)){
  14. flag = true;
  15. break;
  16. }
  17. }
  18. if (flag){
  19. JOptionPane.showMessageDialog(frame, "Login Successful!");
  20. new BookingT();
  21. frame.setVisible(false);
  22. }else{
  23. JOptionPane.showMessageDialog(frame, "Invalid username or password");
  24. username.setText("");
  25. password.setText("");
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement