Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.84 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package login;
  7.  
  8. import java.net.URL;
  9. import java.util.ResourceBundle;
  10. import javafx.event.ActionEvent;
  11. import javafx.fxml.FXML;
  12. import javafx.fxml.Initializable;
  13. import javafx.scene.control.Button;
  14. import javafx.scene.control.Label;
  15. import javafx.scene.control.TextField;
  16. import javax.swing.JOptionPane;
  17.  
  18.  
  19. /**
  20.  *
  21.  * @author Tomas
  22.  */
  23. public class FXMLDocumentController implements Initializable {
  24.    
  25.     @FXML
  26.     public TextField txtUserName;
  27.     public TextField txtPassword;
  28.     public Button btnLogin;
  29.     public Button btnRegister;
  30.    
  31.    
  32.     public void login(ActionEvent event)  throws InterruptedException
  33.     {
  34.        String succesfullLogin = "Your login has been succesfull";
  35.        String wrongPassword = "Wrong password";
  36.        String wrongUserName = " This username doesn't exist";
  37.        doesUserExist();
  38.        if (doesUserExist() && correctPassword())
  39.        {
  40.            JOptionPane.showMessageDialog(null, succesfullLogin);
  41.            Thread.sleep(4000);
  42.            //Login.startHome(Stage);
  43.            //Hier wil ik die login.startHome hebben!
  44.        }
  45.        else if(doesUserExist())
  46.        {
  47.             JOptionPane.showMessageDialog(null, wrongPassword);
  48.  
  49.        }
  50.        else if(!doesUserExist())
  51.        {
  52.             JOptionPane.showMessageDialog(null, wrongUserName);
  53.  
  54.        }
  55.     }
  56.    
  57.       public boolean doesUserExist(){
  58.         return txtUserName.getText().equals("Tomas");
  59.     }
  60.      
  61.       public boolean correctPassword(){
  62.         return txtPassword.getText().equals("test");
  63. }
  64.    
  65.     @Override
  66.     public void initialize(URL url, ResourceBundle rb) {
  67.         // TODO
  68.     }    
  69.    
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement