Package View

Class CustomerRegistrationView

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class CustomerRegistrationView extends JPanel
The CustomerRegistrationView class represents a graphical user interface for customer registration. It allows users to input their registration information, including username, email, password, and confirmation password. Users can register or cancel the registration process. Additionally, a "Show Password" checkbox is provided to toggle the visibility of the password fields.

This class is part of the App's user interface and is used in the customer registration process.

See Also:
  • Field Details

    • usernameField

      private JTextField usernameField
      The text field for entering the desired username.
    • emailField

      private JTextField emailField
      The text field for entering the user's email address.
    • passwordField

      private JPasswordField passwordField
      The password field for entering the user's desired password.
    • confirmPasswordField

      private JPasswordField confirmPasswordField
      The password field for confirming the user's password.
    • registerButton

      private JButton registerButton
      The button for initiating the registration process.
    • cancelButton

      private JButton cancelButton
      The button for canceling the registration process.
    • showPasswordCheckBox

      private JCheckBox showPasswordCheckBox
      A checkbox that, when selected, makes the password fields visible.
    • app

      App app
      Reference to the App class, used for interactions and communication between the view and the application logic.
  • Constructor Details

    • CustomerRegistrationView

      public CustomerRegistrationView(App app)
      Constructs the customer registration view. Initializes the layout, background color, and border of the view.
      Parameters:
      app - The reference to the parent application.
  • Method Details

    • validateRegistration

      private boolean validateRegistration(String username, String email, String password, String confirmPassword)
      Validates the registration details entered by the user.

      This method performs validation checks on the provided registration details, including the username, email, password, and confirm password. It displays error messages using JOptionPane if any validation errors are encountered. If all validation checks pass, it calls the registerNewUser method of the parent application to register the new user.

      Parameters:
      username - The username entered by the user.
      email - The email entered by the user.
      password - The password entered by the user.
      confirmPassword - The confirmed password entered by the user.
      Returns:
      true if the registration details are valid and the user is successfully registered, false otherwise.
      Throws:
      NullPointerException - if any of the parameters are null.
      See Also: