Browse Source

Added a firstname and surname field to SignUpGUI

remotes/origin/server
Richard Schmidt 11 months ago
parent
commit
522f04d359
  1. 12
      src/main/java/CreateUser.java
  2. 35
      src/main/java/SignUpGUI.java

12
src/main/java/CreateUser.java

@ -17,6 +17,8 @@ class CreateUser {
private String userName;
private String password;
private String birthday;
private String firstName;
private String surName;
private boolean stayLoggedIn;
@ -26,6 +28,8 @@ class CreateUser {
this.userName = name;
this.password = password;
this.birthday = birthday;
this.firstName = firstName;
this.surName = surName;
}
// Getters and Setters
@ -61,6 +65,14 @@ class CreateUser {
this.birthday = birthday;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public boolean isStayLoggedIn() {
return stayLoggedIn;
}

35
src/main/java/SignUpGUI.java

@ -5,12 +5,12 @@ import java.util.List;
import java.util.UUID;
public class SignUpGUI extends JFrame implements ActionListener {
private JTextField usernameField, passwordField, confirmPasswordField, birthdayField;
private JTextField usernameField, passwordField, confirmPasswordField, birthdayField, firstNameField, surnameField;
private JButton signUpButton;
public SignUpGUI() {
setTitle("Sign Up");
setSize(300, 250);
setSize(400, 300); // Adjusted size for accommodating more fields
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLayout(null);
@ -19,7 +19,7 @@ public class SignUpGUI extends JFrame implements ActionListener {
add(usernameLabel);
usernameField = new JTextField();
usernameField.setBounds(100, 20, 160, 25);
usernameField.setBounds(140, 20, 160, 25);
add(usernameField);
JLabel passwordLabel = new JLabel("Password:");
@ -27,7 +27,7 @@ public class SignUpGUI extends JFrame implements ActionListener {
add(passwordLabel);
passwordField = new JPasswordField();
passwordField.setBounds(100, 50, 160, 25);
passwordField.setBounds(140, 50, 160, 25);
add(passwordField);
JLabel confirmPasswordLabel = new JLabel("Confirm Password:");
@ -35,22 +35,37 @@ public class SignUpGUI extends JFrame implements ActionListener {
add(confirmPasswordLabel);
confirmPasswordField = new JPasswordField();
confirmPasswordField.setBounds(140, 80, 120, 25);
confirmPasswordField.setBounds(140, 80, 160, 25);
add(confirmPasswordField);
JLabel firstNameLabel = new JLabel("First Name:"); // New field for first name
firstNameLabel.setBounds(20, 110, 80, 25);
add(firstNameLabel);
firstNameField = new JTextField();
firstNameField.setBounds(140, 110, 160, 25);
add(firstNameField);
JLabel surnameLabel = new JLabel("Surname:"); // New field for surname
surnameLabel.setBounds(20, 140, 80, 25);
add(surnameLabel);
surnameField = new JTextField();
surnameField.setBounds(140, 140, 160, 25);
add(surnameField);
JLabel birthdayLabel = new JLabel("Birthday:");
birthdayLabel.setBounds(20, 110, 80, 25);
birthdayLabel.setBounds(20, 170, 80, 25);
add(birthdayLabel);
birthdayField = new JTextField();
birthdayField.setBounds(100, 110, 160, 25);
birthdayField.setBounds(140, 170, 160, 25);
add(birthdayField);
signUpButton = new JButton("Sign Up");
signUpButton.setBounds(100, 150, 100, 25);
signUpButton.setBounds(140, 210, 100, 25); // Adjusted position
signUpButton.addActionListener(this);
add(signUpButton);
}
@Override

Loading…
Cancel
Save