Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Controller {
- @FXML
- AnchorPane signInPane;
- @FXML
- private TextField usernameForSignIn;
- @FXML
- private PasswordField password;
- @FXML
- private Button signIn;
- @FXML
- private Button registration;
- @FXML
- void initialize() {
- registration.setOnAction(event -> {
- signInPane.setVisible(false);
- SignUpController.registerPane.setVisible(true);
- });
- signIn.setOnAction(event -> {
- String usernameText = usernameForSignIn.getText().trim();
- String passwordText = password.getText().trim();
- if(!usernameText.equals("") && !passwordText.equals("")) {
- loginUser(usernameText, passwordText);
- } else {
- System.out.println("Empty login and/or password");
- }
- });
- }
- private void loginUser(String usernameText, String passwordText) {
- }
- }
- public class SignUpController {
- @FXML
- static AnchorPane registerPane;
- @FXML
- private TextField email;
- @FXML
- private PasswordField pass;
- @FXML
- private Button signUp;
- @FXML
- private TextField fname;
- @FXML
- private TextField lname;
- @FXML
- private TextField username;
- @FXML
- private RadioButton radioMale;
- @FXML
- void initialize() {
- signUp.setOnAction(event -> {
- signUpNewUser();
- });
- }
- private void signUpNewUser() {
- DatabaseHandler databaseHandler = new DatabaseHandler();
- String firstName = fname.getText();
- String lastName = lname.getText();
- String usname = username.getText();
- String password = pass.getText();
- String e_mail = email.getText();
- String gender = "";
- if(radioMale.isSelected()) {
- gender = "Male";
- } else {
- gender = "Female";
- }
- User user = new User(firstName,lastName,usname,password,e_mail,gender);
- databaseHandler.signUpUser(user);
- }
- }
- registration.setOnAction(event -> {
- registration.getScene().getWindow().hide();
- FXMLLoader loader = new FXMLLoader();
- loader.setLocation(getClass().getResource("/sample/view/signUp.fxml"));
- try {
- loader.load();
- } catch (IOException e) {
- e.printStackTrace();
- }
- Parent root = loader.getRoot();
- Stage stage = new Stage();
- stage.setScene(new Scene(root));
- stage.showAndWait();
- // signInPane.setVisible(false);
- });
Add Comment
Please, Sign In to add comment