From 11d5f5b53f95fe92772f92494ccb69e9e75b365d Mon Sep 17 00:00:00 2001 From: sebaici Date: Mon, 13 Nov 2023 11:28:38 +0100 Subject: [PATCH] modif de la vue sign up et des noms d'arguments --- src/main/java/controller/Controller.java | 4 ++-- src/main/java/view/Vue.java | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/controller/Controller.java b/src/main/java/controller/Controller.java index 8e87b0e..be33b08 100644 --- a/src/main/java/controller/Controller.java +++ b/src/main/java/controller/Controller.java @@ -2,10 +2,10 @@ public class Controller { - public static void logIn(String text, char[] password) { + public static void logIn(String login, char[] password) { } - public static void createNewUser(String text, String text1, String text2, String password, boolean selected, boolean selected1, boolean selected2) { + public static void createNewUser(String firstName, String lastName, String email, String password, boolean isNeeder, boolean isVolunteer, boolean isValidator) { } } diff --git a/src/main/java/view/Vue.java b/src/main/java/view/Vue.java index 922d968..f2d7883 100644 --- a/src/main/java/view/Vue.java +++ b/src/main/java/view/Vue.java @@ -38,9 +38,12 @@ private static void createAndShowSignUpForm() { //Create all the components. JPanel typePanel = new JPanel(); JPanel formPanel = new JPanel(); + JPanel namePanel = new JPanel(); JLabel labelTitle = new JLabel("Sign Up", JLabel.CENTER); - JLabel labelName = new JLabel("Name"); - JTextField textFieldName = new JTextField(); + JLabel labelFirstName = new JLabel("First Name"); + JTextField textFieldFirstName = new JTextField(); + JLabel labelLastName = new JLabel("Last Name"); + JTextField textFieldLastName = new JTextField(); JLabel labelEmail = new JLabel("Email"); JTextField textFieldEmail = new JTextField(); JLabel labelPassword = new JLabel("Password"); @@ -58,15 +61,24 @@ private static void createAndShowSignUpForm() { formPanel.setLayout(new BoxLayout(formPanel, BoxLayout.Y_AXIS)); frame.getContentPane().add(formPanel, "North"); frame.getContentPane().add(validateButton, "South"); + namePanel.setLayout(new BoxLayout(namePanel, BoxLayout.X_AXIS)); + labelFirstName.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + labelLastName.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + //Add the components to the panel. typePanel.add(checkBoxIsNeeder); typePanel.add(checkBoxIsVolunteer); typePanel.add(checkBoxIsValidator); + namePanel.add(labelFirstName); + namePanel.add(textFieldFirstName); + namePanel.add(labelLastName); + namePanel.add(textFieldLastName); + + formPanel.add(labelTitle); - formPanel.add(labelName); - formPanel.add(textFieldName); + formPanel.add(namePanel); formPanel.add(typePanel); formPanel.add(labelEmail); formPanel.add(textFieldEmail); @@ -103,8 +115,8 @@ private static void createAndShowSignUpForm() { } }); - validateButton.addActionListener(actionEvent -> Controller.createNewUser(labelTitle.getText(), - textFieldName.getText(), + validateButton.addActionListener(actionEvent -> Controller.createNewUser(textFieldFirstName.getText(), + textFieldLastName.getText(), textFieldEmail.getText(), Arrays.toString(passwordField.getPassword()), checkBoxIsNeeder.isSelected(),