package Main;

import static Main.Main.Frame;
import javax.swing.JFrame;

/**
 *
 * @author Jonathan Zamora
 */
public class RegisterPanel extends javax.swing.JPanel{

    /**
     * Creates new RegisterPanel
     */
    public RegisterPanel() {
        initComponents();
    }
    
    boolean hiding1 = false;
    boolean hiding2 = false;
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the FormEditor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        EmailField = new javax.swing.JTextField();
        ConfirmPasswordField = new javax.swing.JPasswordField();
        EmailField1 = new javax.swing.JTextField();
        ComboCounterTitle = new javax.swing.JLabel();
        PasswordField = new javax.swing.JPasswordField();
        HidePassword = new javax.swing.JLabel();
        HidePassword2 = new javax.swing.JLabel();
        EmailField2 = new javax.swing.JTextField();
        EmailField3 = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        SignUpButton = new javax.swing.JButton();
        LogInButton = new javax.swing.JButton();

        setBackground(new java.awt.Color(0, 0, 55));
        setForeground(new java.awt.Color(255, 255, 255));
        setPreferredSize(new java.awt.Dimension(400, 300));
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        EmailField.setBackground(new java.awt.Color(0, 0, 55));
        EmailField.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        EmailField.setForeground(new java.awt.Color(255, 255, 255));
        EmailField.setText("Username");
        EmailField.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 2, 0, new java.awt.Color(102, 102, 102)));
        add(EmailField, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 280, 330, 50));

        ConfirmPasswordField.setBackground(new java.awt.Color(0, 0, 55));
        ConfirmPasswordField.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        ConfirmPasswordField.setForeground(new java.awt.Color(255, 255, 255));
        ConfirmPasswordField.setText("Confirm Password");
        ConfirmPasswordField.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 2, 0, new java.awt.Color(102, 102, 102)));
        ConfirmPasswordField.setEchoChar((char)0);
        add(ConfirmPasswordField, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 470, 330, 50));

        EmailField1.setBackground(new java.awt.Color(0, 0, 55));
        EmailField1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        EmailField1.setForeground(new java.awt.Color(255, 255, 255));
        EmailField1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        EmailField1.setText("Weight");
        EmailField1.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 2, 0, new java.awt.Color(102, 102, 102)));
        add(EmailField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 590, 110, 50));

        ComboCounterTitle.setFont(new java.awt.Font("Tahoma", 1, 48)); // NOI18N
        ComboCounterTitle.setForeground(new java.awt.Color(0, 122, 203));
        ComboCounterTitle.setText("ComboCounter");
        add(ComboCounterTitle, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 60, -1, -1));

        PasswordField.setBackground(new java.awt.Color(0, 0, 55));
        PasswordField.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        PasswordField.setForeground(new java.awt.Color(255, 255, 255));
        PasswordField.setText("Password");
        PasswordField.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 2, 0, new java.awt.Color(102, 102, 102)));
        PasswordField.setEchoChar((char)0);
        add(PasswordField, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 370, 330, 50));

        HidePassword.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/filledCircleIcon.png"))); // NOI18N
        HidePassword.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                HidePasswordMouseClicked(evt);
            }
        });
        add(HidePassword, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 390, 30, 30));

        HidePassword2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/filledCircleIcon.png"))); // NOI18N
        HidePassword2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                HidePassword2MouseClicked(evt);
            }
        });
        add(HidePassword2, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 490, 30, 30));

        EmailField2.setBackground(new java.awt.Color(0, 0, 55));
        EmailField2.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        EmailField2.setForeground(new java.awt.Color(255, 255, 255));
        EmailField2.setText("Email");
        EmailField2.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 2, 0, new java.awt.Color(102, 102, 102)));
        add(EmailField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 190, 330, 50));

        EmailField3.setBackground(new java.awt.Color(0, 0, 55));
        EmailField3.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        EmailField3.setForeground(new java.awt.Color(255, 255, 255));
        EmailField3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        EmailField3.setText("Age");
        EmailField3.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 2, 0, new java.awt.Color(102, 102, 102)));
        add(EmailField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 590, 90, 50));

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(255, 255, 255));
        jLabel1.setText("lbs");
        add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 600, -1, -1));

        SignUpButton.setBackground(new java.awt.Color(51, 51, 51));
        SignUpButton.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        SignUpButton.setForeground(new java.awt.Color(240, 240, 240));
        SignUpButton.setText("Sign Up");
        SignUpButton.setBorder(null);
        SignUpButton.setBorderPainted(false);
        SignUpButton.setFocusable(false);
        SignUpButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                SignUpButtonMouseClicked(evt);
            }
        });
        add(SignUpButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 700, 150, 40));

        LogInButton.setBackground(new java.awt.Color(51, 51, 51));
        LogInButton.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        LogInButton.setForeground(new java.awt.Color(240, 240, 240));
        LogInButton.setText("Log In");
        LogInButton.setBorder(null);
        LogInButton.setBorderPainted(false);
        LogInButton.setFocusable(false);
        LogInButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                LogInButtonMouseClicked(evt);
            }
        });
        add(LogInButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(300, 790, 150, 40));
    }// </editor-fold>//GEN-END:initComponents

    private void HidePasswordMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HidePasswordMouseClicked
        if (hiding1 == false)
        {
            HidePassword.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/emptyCircleIcon.png")));
            PasswordField.setEchoChar('*');
            hiding1 = true;
        }
        else if (hiding1 == true)
        {
            HidePassword.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/filledCircleIcon.png")));
            PasswordField.setEchoChar((char)0);
            hiding1 = false;
        }

    }//GEN-LAST:event_HidePasswordMouseClicked

    private void HidePassword2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HidePassword2MouseClicked
        if (hiding2 == false)
        {
            HidePassword2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/emptyCircleIcon.png")));
            ConfirmPasswordField.setEchoChar('*');
            hiding2 = true;
        }
        else if (hiding2 == true)
        {
            HidePassword2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/filledCircleIcon.png")));
            ConfirmPasswordField.setEchoChar((char)0);
            hiding2 = false;
        }

    }//GEN-LAST:event_HidePassword2MouseClicked

    private void SignUpButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SignUpButtonMouseClicked
        Main.setup(2);
    }//GEN-LAST:event_SignUpButtonMouseClicked

    private void LogInButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogInButtonMouseClicked
        Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Frame.setContentPane(new LoginPanel());
        Frame.setSize(768,1024);
        Frame.setResizable(false);
        Frame.repaint();
        Frame.revalidate();
    }//GEN-LAST:event_LogInButtonMouseClicked


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel ComboCounterTitle;
    private javax.swing.JPasswordField ConfirmPasswordField;
    private javax.swing.JTextField EmailField;
    private javax.swing.JTextField EmailField1;
    private javax.swing.JTextField EmailField2;
    private javax.swing.JTextField EmailField3;
    private javax.swing.JLabel HidePassword;
    private javax.swing.JLabel HidePassword2;
    private javax.swing.JButton LogInButton;
    private javax.swing.JPasswordField PasswordField;
    private javax.swing.JButton SignUpButton;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
}
