Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package login;
- import java.net.URL;
- import java.util.ResourceBundle;
- import javafx.event.ActionEvent;
- import javafx.fxml.FXML;
- import javafx.fxml.Initializable;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.TextField;
- import javax.swing.JOptionPane;
- /**
- *
- * @author Tomas
- */
- public class FXMLDocumentController implements Initializable {
- @FXML
- public TextField txtUserName;
- public TextField txtPassword;
- public Button btnLogin;
- public Button btnRegister;
- public void login(ActionEvent event) throws InterruptedException
- {
- String succesfullLogin = "Your login has been succesfull";
- String wrongPassword = "Wrong password";
- String wrongUserName = " This username doesn't exist";
- doesUserExist();
- if (doesUserExist() && correctPassword())
- {
- JOptionPane.showMessageDialog(null, succesfullLogin);
- Thread.sleep(4000);
- //Login.startHome(Stage);
- //Hier wil ik die login.startHome hebben!
- }
- else if(doesUserExist())
- {
- JOptionPane.showMessageDialog(null, wrongPassword);
- }
- else if(!doesUserExist())
- {
- JOptionPane.showMessageDialog(null, wrongUserName);
- }
- }
- public boolean doesUserExist(){
- return txtUserName.getText().equals("Tomas");
- }
- public boolean correctPassword(){
- return txtPassword.getText().equals("test");
- }
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- // TODO
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement