Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean flag = false;
- Scanner fileInput = new Scanner(new File("Account"));
- BufferedReader br = new BufferedReader(new FileReader("Account"));
- if (br.readLine()==null){
- JOptionPane.showMessageDialog(frame, "Record is empty! Please register an account!");
- new Registration();
- frame.setVisible(false);
- }
- else{
- while(fileInput.hasNextLine()){
- String user = fileInput.nextLine();
- String pass = fileInput.nextLine();
- if (a.equals(user) && b.equals(pass)){
- flag = true;
- break;
- }
- }
- if (flag){
- JOptionPane.showMessageDialog(frame, "Login Successful!");
- new BookingT();
- frame.setVisible(false);
- }else{
- JOptionPane.showMessageDialog(frame, "Invalid username or password");
- username.setText("");
- password.setText("");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement