-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignUpController.java
More file actions
44 lines (44 loc) · 1.56 KB
/
SignUpController.java
File metadata and controls
44 lines (44 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.example.loanproject;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import java.net.URL;
import java.util.ResourceBundle;
public class SignUpController implements Initializable {
@FXML
private Button button_signup;
@FXML
private Button button_login;
@FXML
private TextField tf_username;
@FXML
private TextField tf_password;
@Override
public void initialize(URL location, ResourceBundle resources) {
button_signup.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
if (!(tf_username.getText().trim().isEmpty() && tf_password.getText().trim().isEmpty()))
{
DBUtils.signUpUser(event,tf_username.getText(),tf_password.getText());
}
else {
System.out.println("Please fill in all information");
Alert alert=new Alert(Alert.AlertType.ERROR);
alert.setContentText("Please fill in all information to sign up");
alert.show();
}
}
});
button_login.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
DBUtils.changeScene(event,"sample.fxml","Log in",null);
}
});
}
}