commit 404280bb628c684c60e2b91ef206b936a4f12bb0
parent aad6e0dde33501fbcad27528bcc5e69728b08e6d
Author: lukeeeeeee334 <lukeosullivan123@gmail.com>
Date: Sun, 10 Nov 2024 15:16:19 +0000
updated register.java
added name and surname textfields to the register.java
Diffstat:
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/register.java b/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/register.java
@@ -14,15 +14,15 @@ import javax.swing.Box;
/**
*
- * Author: Willi
+ * Author: Luke
*/
public class register extends JPanel {
public register(TicTacToeClient client) {
// Set the layout to BoxLayout for vertical alignment
- setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
+ setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
- // Username label and very small text field
-JPanel usernamePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
+ // Username
+ JPanel usernamePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
JLabel usernameLabel = new JLabel("Username:");
JTextField usernameField = new JTextField(15);
usernameField.setPreferredSize(new Dimension(600, 20));
@@ -30,18 +30,34 @@ JPanel usernamePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
usernamePanel.add(usernameField);
add(usernamePanel);
- // Password label and very small text field
+ // Password
JPanel passwordPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
JLabel passwordLabel = new JLabel("Password:");
JTextField passwordField = new JTextField(15);
- passwordField.setMaximumSize(new Dimension(600, 20)); // Forces small width
+ passwordField.setPreferredSize(new Dimension(600, 20));
passwordPanel.add(passwordLabel);
passwordPanel.add(passwordField);
add(passwordPanel);
+
+ // Name
+ JPanel namePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
+ JLabel nameLabel = new JLabel("Name:");
+ JTextField nameField = new JTextField(10); // adjusting width
+ namePanel.add(nameLabel);
+ namePanel.add(nameField);
+
+ // Surname
+ JLabel surnameLabel = new JLabel("Surname:");
+ JTextField surnameField = new JTextField(10);
+ namePanel.add(surnameLabel);
+ namePanel.add(surnameField);
+
+
+ add(namePanel);
// Register button
JButton registerButton = new JButton("Register");
- add(Box.createVerticalStrut(10)); // Add space between fields and button
+ add(Box.createVerticalStrut(10));
add(registerButton);
// Action listener for register button
@@ -52,4 +68,4 @@ JPanel usernamePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
}
});
}
-}
+}
+\ No newline at end of file