private void NewSubmitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewSubmitButtonActionPerformed

        try {
            messageLabel.setText(null);
            Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "oracle");
            Statement s = con.createStatement();
            ResultSet rs = s.executeQuery("select username from airline_user");
            String username = NewUserNameTextField.getText();
            String email = NewEmaidTextField.getText();
            String password = NewPasswordField.getText();
            if (username.equals("") || email.equals("") || password.equals("") || NewConfirmPasswordField.getText().equals("")) {
                messageLabel.setText("All fields are mandatory!");
                con.close();
                return;
            }

            if (!password.equals(NewConfirmPasswordField.getText())) {
                messageLabel.setText("Passwords does not match!");
                con.close();
                return;
            }

            while (rs.next()) {
                if (rs.getString(1).equals(username)) {
                    messageLabel.setText("Invalid username!");
                    con.close();
                    return;
                }
            }
            s.executeUpdate("insert into airline_user values(user_seq.Nextval,'" + username + "','" + email + "','" + password + "')");
            con.close();
            java.awt.CardLayout cardLayout = (java.awt.CardLayout) (LoginPanel.getLayout());
            cardLayout.show(LoginPanel, "card1");
            UsernameTextField.setText("");
            PasswordField.setText("**********");
            successMessageLabel.setText("Registration successful! Login here.");

        } catch (SQLException se) {
            System.out.println(se);
        }
    }//GEN-LAST:event_NewSubmitButtonActionPerformed