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

35
src/main/java/SignUpGUI.java

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

Loading…
Cancel
Save