/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package VoiceRecognizer;

import java.sql.*;
import java.util.Date;
import static VoiceRecognizer.Escucha.recognizer;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.speech.AudioException;
import javax.speech.Central;
import javax.speech.EngineException;
import javax.speech.EngineModeDesc;
import javax.speech.EngineStateError;
import javax.speech.recognition.Recognizer;
import javax.speech.recognition.Result;
import javax.speech.recognition.ResultEvent;
import javax.speech.recognition.ResultToken;
import javax.speech.recognition.RuleGrammar;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.*;
import java.io.FileNotFoundException;
import java.net.URL;
import javax.swing.*;

/**
 *
 * @author xyto_
 */
public class Principal extends javax.swing.JFrame {

    /**
     * Creates new form Principal
     */
    public Principal() {
        initComponents();
        this.setLocationRelativeTo(this);

        ConectarDB();

        ListaUsuarios();
        ListaContactos();
        ListaMensajes();
        ListaBitacoras();
        ListaComando();

        EscrbirComandosEnTexto();

        LlenarInbox();

        ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Inicio el programa el usuario", UsuarioIngresado.getUserName()));
        InsertarBitacoraEnDB(FechaBitacora.toString(), "Inicio el programa el usuario", UsuarioIngresado.getUserName());
        LlenarBitacora();

        Botones.add(jb_microphone_Contacts);
        Botones.add(jb_microphone_Inbox);
        Botones.add(jb_microphone_LogIn);

        Recognizer();
        recognizer.pause();
    }

    /**
     * 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 Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jd_CreateAccount = new javax.swing.JDialog();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jt_FirstName_CreateAccount = new javax.swing.JTextField();
        jt_LastName_CreateAccount = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jt_Username_CreateAccount = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jt_Day_CreateAccount = new javax.swing.JTextField();
        cb_Month_CreateAccount = new javax.swing.JComboBox<>();
        jt_Year_CreateAccount = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        cb_Gender_CreateAccount = new javax.swing.JComboBox<>();
        jLabel8 = new javax.swing.JLabel();
        cb_Location_CreateAccount = new javax.swing.JComboBox<>();
        jLabel9 = new javax.swing.JLabel();
        jt_PhoneNumber_CreateAccount = new javax.swing.JTextField();
        jt_Password_CreateAccount = new javax.swing.JPasswordField();
        jt_ConfirmPassword_CreateAccount = new javax.swing.JPasswordField();
        jb_CreateAccount_CreateAccount = new javax.swing.JButton();
        jd_User = new javax.swing.JDialog();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jt_FirstName_Profile = new javax.swing.JTextField();
        jt_LastName_Profile = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jt_Username_Profile = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jt_Password_Profile = new javax.swing.JPasswordField();
        jLabel13 = new javax.swing.JLabel();
        jt_ConfirmPassword_Profile = new javax.swing.JPasswordField();
        jLabel14 = new javax.swing.JLabel();
        jt_Day_Profile = new javax.swing.JTextField();
        cb_Month_Profile = new javax.swing.JComboBox<>();
        jt_Year_Profile = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        cb_Gender_Profile = new javax.swing.JComboBox<>();
        jLabel16 = new javax.swing.JLabel();
        cb_Location_Profile = new javax.swing.JComboBox<>();
        jLabel17 = new javax.swing.JLabel();
        jt_PhoneNumber_Profile = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jl_Imagen_Contacts = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jt_Name_Contacts = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jt_PhoneticName_Contacts = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jt_NickName_Contacts = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        cb_Location_Contacts = new javax.swing.JComboBox<>();
        jLabel23 = new javax.swing.JLabel();
        jt_Phone_Contacts = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jt_Day_Contacts = new javax.swing.JTextField();
        cb_Month_Contacts = new javax.swing.JComboBox<>();
        jt_Year_Contacts = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        jt_Email_Contacts = new javax.swing.JTextField();
        jb_microphone_Contacts = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel26 = new javax.swing.JLabel();
        cb_Recipients_Inbox = new javax.swing.JComboBox<>();
        jLabel27 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jta_Subject_Inbox = new javax.swing.JTextArea();
        jScrollPane2 = new javax.swing.JScrollPane();
        jtable_Inbox_Inbox = new javax.swing.JTable();
        jb_microphone_Inbox = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jta_History_History = new javax.swing.JTextArea();
        jd_VoiceCall = new javax.swing.JDialog();
        jl_Imagen_VoiceCall = new javax.swing.JLabel();
        jl_TiempoLlamada = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        jb_microphone_LogIn = new javax.swing.JButton();
        jt_Username_LogIn = new javax.swing.JTextField();
        jb_CreateAccount_LogIn = new javax.swing.JButton();
        jt_Password_LogIn = new javax.swing.JPasswordField();

        jd_CreateAccount.setTitle("CREATE YOUR ACCOUNT");
        jd_CreateAccount.setResizable(false);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel1.setText("Create your account");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel2.setText("Name");

        jt_FirstName_CreateAccount.setText("First");

        jt_LastName_CreateAccount.setText("Last");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setText("Choose your username");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setText("Create a password");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Confirm your password");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel6.setText("Birthday");

        jt_Day_CreateAccount.setText("DAY");

        cb_Month_CreateAccount.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }));

        jt_Year_CreateAccount.setText("YEAR");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel7.setText("Gender");

        cb_Gender_CreateAccount.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Female", "Male", "Other", "Rather not say" }));

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel8.setText("Location");

        cb_Location_CreateAccount.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "+1 –  Canada", "+1 –  United States", "+1 787 / 939 –  Puerto Rico", "+1 242 –  Bahamas", "+1 246 –  Barbados", "+1 264 –  Anguilla", "+1 268 –  Antigua and Barbuda", "+1 284 –  British Virgin Islands", "+1 345 –  Cayman Islands", "+1 441 –  Bermuda", "+1 473 –  Grenada", "+1 649 –  Turks and Caicos Islands", "+1 664 –  Montserrat", "+1 721 –  Sint Maarten", "+1 758 –  Saint Lucia", "+1 767 –  Dominica", "+1 784 –  Saint Vincent and the Grenadines", "+1 809 / 829 / 849 –  Dominican Republic", "+1 868 –  Trinidad and Tobago", "+1 869 –  Saint Kitts and Nevis", "+1 876 –  Jamaica", "+30 –  Greece", "+31 –  Netherlands", "+32 –  Belgium", "+33 –  France", "+34 –  Spain", "+350 –  Gibraltar", "+351 –  Portugal", "+352 –  Luxembourg", "+353 –  Ireland", "+354 –  Iceland", "+355 –  Albania", "+356 –  Malta", "+357 –  Cyprus", "+358 –  Finland", "+358 18 –  Åland Islands", "+359 –  Bulgaria", "+36 –  Hungary", "+500 –  Falkland Islands", "+500 x –  South Georgia and South Sandwich Islands", "+501 –  Belize", "+502 –  Guatemala", "+503 –  El Salvador", "+504 –  Honduras", "+505 –  Nicaragua", "+506 –  Costa Rica", "+507 –  Panama", "+508 –  Saint-Pierre and Miquelon", "+509 –  Haiti", "+51 –  Peru", "+52 –  Mexico", "+53 –  Cuba", "+54 –  Argentina", "+55 –  Brazil", "+56 –  Chile", "+57 –  Colombia", "+58 –  Venezuela", "+590 –  Guadeloupe", "+591 –  Bolivia", "+592 –  Guyana", "+593 –  Ecuador", "+595 –  Paraguay", "+596 –  Martinique", "+597 –  Suriname", "+598 –  Uruguay" }));
        cb_Location_CreateAccount.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb_Location_CreateAccountItemStateChanged(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel9.setText("Phone number");

        jb_CreateAccount_CreateAccount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/add-icon.png"))); // NOI18N
        jb_CreateAccount_CreateAccount.setText("CREATE ACCOUNT");
        jb_CreateAccount_CreateAccount.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jb_CreateAccount_CreateAccountMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jd_CreateAccountLayout = new javax.swing.GroupLayout(jd_CreateAccount.getContentPane());
        jd_CreateAccount.getContentPane().setLayout(jd_CreateAccountLayout);
        jd_CreateAccountLayout.setHorizontalGroup(
            jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jd_CreateAccountLayout.createSequentialGroup()
                .addGap(271, 271, 271)
                .addComponent(jLabel1)
                .addContainerGap(315, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jd_CreateAccountLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jt_Username_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jt_ConfirmPassword_CreateAccount, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                        .addComponent(jt_Password_CreateAccount, javax.swing.GroupLayout.Alignment.LEADING))
                    .addGroup(jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(jd_CreateAccountLayout.createSequentialGroup()
                            .addComponent(jt_Day_CreateAccount)
                            .addGap(18, 18, 18)
                            .addComponent(cb_Month_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(jt_Year_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(17, 17, 17))
                        .addGroup(jd_CreateAccountLayout.createSequentialGroup()
                            .addComponent(jt_FirstName_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jt_LastName_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jt_PhoneNumber_CreateAccount, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(cb_Location_CreateAccount, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(cb_Gender_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jd_CreateAccountLayout.createSequentialGroup()
                        .addGap(31, 31, 31)
                        .addComponent(jb_CreateAccount_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(113, 113, 113))
        );

        jd_CreateAccountLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jt_FirstName_CreateAccount, jt_LastName_CreateAccount});

        jd_CreateAccountLayout.setVerticalGroup(
            jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jd_CreateAccountLayout.createSequentialGroup()
                .addGap(35, 35, 35)
                .addComponent(jLabel1)
                .addGap(36, 36, 36)
                .addComponent(jLabel2)
                .addGap(18, 18, 18)
                .addGroup(jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jt_FirstName_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jt_LastName_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(35, 35, 35)
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(jt_Username_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addComponent(jLabel4)
                .addGap(27, 27, 27)
                .addComponent(jt_Password_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jLabel5)
                .addGap(18, 18, 18)
                .addComponent(jt_ConfirmPassword_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35)
                .addComponent(jLabel6)
                .addGap(18, 18, 18)
                .addGroup(jd_CreateAccountLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jt_Day_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cb_Month_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jt_Year_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(38, 38, 38)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cb_Gender_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(33, 33, 33)
                .addComponent(jLabel8)
                .addGap(18, 18, 18)
                .addComponent(cb_Location_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(jLabel9)
                .addGap(18, 18, 18)
                .addComponent(jt_PhoneNumber_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jb_CreateAccount_CreateAccount, javax.swing.GroupLayout.PREFERRED_SIZE, 54, Short.MAX_VALUE)
                .addGap(39, 39, 39))
        );

        jd_CreateAccountLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jt_FirstName_CreateAccount, jt_LastName_CreateAccount});

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel10.setText("Name");

        jt_FirstName_Profile.setText("First");

        jt_LastName_Profile.setText("Last");

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel11.setText("Choose your username");

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel12.setText("Create a password");

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel13.setText("Confirm your password");

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel14.setText("Birthday");

        jt_Day_Profile.setText("DAY");

        cb_Month_Profile.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }));

        jt_Year_Profile.setText("YEAR");

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel15.setText("Gender");

        cb_Gender_Profile.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Female", "Male", "Other", "Rather not say" }));

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel16.setText("Location");

        cb_Location_Profile.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "+1 –  Canada", "+1 –  United States", "+1 787 / 939 –  Puerto Rico", "+1 242 –  Bahamas", "+1 246 –  Barbados", "+1 264 –  Anguilla", "+1 268 –  Antigua and Barbuda", "+1 284 –  British Virgin Islands", "+1 345 –  Cayman Islands", "+1 441 –  Bermuda", "+1 473 –  Grenada", "+1 649 –  Turks and Caicos Islands", "+1 664 –  Montserrat", "+1 721 –  Sint Maarten", "+1 758 –  Saint Lucia", "+1 767 –  Dominica", "+1 784 –  Saint Vincent and the Grenadines", "+1 809 / 829 / 849 –  Dominican Republic", "+1 868 –  Trinidad and Tobago", "+1 869 –  Saint Kitts and Nevis", "+1 876 –  Jamaica", "+30 –  Greece", "+31 –  Netherlands", "+32 –  Belgium", "+33 –  France", "+34 –  Spain", "+350 –  Gibraltar", "+351 –  Portugal", "+352 –  Luxembourg", "+353 –  Ireland", "+354 –  Iceland", "+355 –  Albania", "+356 –  Malta", "+357 –  Cyprus", "+358 –  Finland", "+358 18 –  Åland Islands", "+359 –  Bulgaria", "+36 –  Hungary", "+500 –  Falkland Islands", "+500 x –  South Georgia and South Sandwich Islands", "+501 –  Belize", "+502 –  Guatemala", "+503 –  El Salvador", "+504 –  Honduras", "+505 –  Nicaragua", "+506 –  Costa Rica", "+507 –  Panama", "+508 –  Saint-Pierre and Miquelon", "+509 –  Haiti", "+51 –  Peru", "+52 –  Mexico", "+53 –  Cuba", "+54 –  Argentina", "+55 –  Brazil", "+56 –  Chile", "+57 –  Colombia", "+58 –  Venezuela", "+590 –  Guadeloupe", "+591 –  Bolivia", "+592 –  Guyana", "+593 –  Ecuador", "+595 –  Paraguay", "+596 –  Martinique", "+597 –  Suriname", "+598 –  Uruguay" }));
        cb_Location_Profile.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb_Location_ProfileItemStateChanged(evt);
            }
        });

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel17.setText("Phone number");

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/50px-Gnome-document-save.svg.png"))); // NOI18N
        jButton3.setText("SAVE CHANGES");
        jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton3MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(29, 29, 29)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jt_PhoneNumber_Profile, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cb_Location_Profile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 263, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 213, Short.MAX_VALUE)
                        .addComponent(jButton3))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10)
                            .addComponent(jLabel12)
                            .addComponent(jLabel13)
                            .addComponent(jLabel14)
                            .addComponent(jLabel15)
                            .addComponent(jLabel16)
                            .addComponent(jLabel17)
                            .addComponent(jt_Username_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jt_ConfirmPassword_Profile, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jt_Password_Profile, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(cb_Gender_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jt_Day_Profile)
                                    .addGap(18, 18, 18)
                                    .addComponent(cb_Month_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18)
                                    .addComponent(jt_Year_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(17, 17, 17))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(jt_FirstName_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jt_LastName_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addComponent(jLabel10)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jt_FirstName_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jt_LastName_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(41, 41, 41)
                .addComponent(jLabel11)
                .addGap(18, 18, 18)
                .addComponent(jt_Username_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addComponent(jLabel12)
                .addGap(27, 27, 27)
                .addComponent(jt_Password_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jLabel13)
                .addGap(18, 18, 18)
                .addComponent(jt_ConfirmPassword_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(35, 35, 35)
                .addComponent(jLabel14)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jt_Day_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cb_Month_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jt_Year_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(44, 44, 44)
                .addComponent(jLabel15)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cb_Gender_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(33, 33, 33)
                .addComponent(jLabel16)
                .addGap(18, 18, 18)
                .addComponent(cb_Location_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(jLabel17)
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jt_PhoneNumber_Profile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Profile", jPanel1);

        jl_Imagen_Contacts.setBackground(new java.awt.Color(51, 51, 51));
        jl_Imagen_Contacts.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jl_Imagen_Contacts.setText("Imagen");
        jl_Imagen_Contacts.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jl_Imagen_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jl_Imagen_ContactsMouseClicked(evt);
            }
        });

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel19.setText("Name");

        jt_Name_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_Name_ContactsMouseClicked(evt);
            }
        });

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel20.setText("Phonetic name");

        jt_PhoneticName_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_PhoneticName_ContactsMouseClicked(evt);
            }
        });

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel21.setText("Nickname");

        jt_NickName_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_NickName_ContactsMouseClicked(evt);
            }
        });

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel22.setText("Location");

        cb_Location_Contacts.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "+1 –  Canada", "+1 –  United States", "+1 787 / 939 –  Puerto Rico", "+1 242 –  Bahamas", "+1 246 –  Barbados", "+1 264 –  Anguilla", "+1 268 –  Antigua and Barbuda", "+1 284 –  British Virgin Islands", "+1 345 –  Cayman Islands", "+1 441 –  Bermuda", "+1 473 –  Grenada", "+1 649 –  Turks and Caicos Islands", "+1 664 –  Montserrat", "+1 721 –  Sint Maarten", "+1 758 –  Saint Lucia", "+1 767 –  Dominica", "+1 784 –  Saint Vincent and the Grenadines", "+1 809 / 829 / 849 –  Dominican Republic", "+1 868 –  Trinidad and Tobago", "+1 869 –  Saint Kitts and Nevis", "+1 876 –  Jamaica", "+30 –  Greece", "+31 –  Netherlands", "+32 –  Belgium", "+33 –  France", "+34 –  Spain", "+350 –  Gibraltar", "+351 –  Portugal", "+352 –  Luxembourg", "+353 –  Ireland", "+354 –  Iceland", "+355 –  Albania", "+356 –  Malta", "+357 –  Cyprus", "+358 –  Finland", "+358 18 –  Åland Islands", "+359 –  Bulgaria", "+36 –  Hungary", "+500 –  Falkland Islands", "+500 x –  South Georgia and South Sandwich Islands", "+501 –  Belize", "+502 –  Guatemala", "+503 –  El Salvador", "+504 –  Honduras", "+505 –  Nicaragua", "+506 –  Costa Rica", "+507 –  Panama", "+508 –  Saint-Pierre and Miquelon", "+509 –  Haiti", "+51 –  Peru", "+52 –  Mexico", "+53 –  Cuba", "+54 –  Argentina", "+55 –  Brazil", "+56 –  Chile", "+57 –  Colombia", "+58 –  Venezuela", "+590 –  Guadeloupe", "+591 –  Bolivia", "+592 –  Guyana", "+593 –  Ecuador", "+595 –  Paraguay", "+596 –  Martinique", "+597 –  Suriname", "+598 –  Uruguay" }));
        cb_Location_Contacts.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                cb_Location_ContactsItemStateChanged(evt);
            }
        });

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel23.setText("Phone number");

        jt_Phone_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_Phone_ContactsMouseClicked(evt);
            }
        });

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel24.setText("Birthday");

        jt_Day_Contacts.setText("DAY");
        jt_Day_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_Day_ContactsMouseClicked(evt);
            }
        });

        cb_Month_Contacts.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }));

        jt_Year_Contacts.setText("YEAR");
        jt_Year_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_Year_ContactsMouseClicked(evt);
            }
        });

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel25.setText("Email");

        jt_Email_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_Email_ContactsMouseClicked(evt);
            }
        });

        jb_microphone_Contacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/Microphone.png"))); // NOI18N
        jb_microphone_Contacts.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jb_microphone_ContactsMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(228, 228, 228)
                .addComponent(jl_Imagen_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, 213, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(253, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel19)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jt_Name_Contacts)
                                .addGap(113, 113, 113)))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel20)
                            .addComponent(jt_PhoneticName_Contacts)
                            .addComponent(jLabel25)
                            .addComponent(jt_Email_Contacts, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE))
                        .addGap(92, 92, 92))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel22)
                            .addComponent(jLabel23)
                            .addComponent(jLabel21)
                            .addComponent(cb_Location_Contacts, 0, 0, Short.MAX_VALUE)
                            .addComponent(jt_NickName_Contacts)
                            .addComponent(jLabel24)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jt_Day_Contacts)
                                .addGap(18, 18, 18)
                                .addComponent(cb_Month_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jt_Year_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jt_Phone_Contacts))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jb_microphone_Contacts)
                        .addGap(154, 154, 154))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jl_Imagen_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jt_PhoneticName_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jt_Name_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(28, 28, 28)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(jLabel25))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jt_NickName_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jt_Email_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addComponent(jLabel22)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(cb_Location_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(7, 7, 7)
                        .addComponent(jb_microphone_Contacts)))
                .addGap(40, 40, 40)
                .addComponent(jLabel23)
                .addGap(18, 18, 18)
                .addComponent(jt_Phone_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addComponent(jLabel24)
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jt_Day_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cb_Month_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jt_Year_Contacts, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(56, 56, 56))
        );

        jTabbedPane1.addTab("Contacts", jPanel2);

        jLabel26.setText("To");

        jLabel27.setText("Subject");

        jta_Subject_Inbox.setColumns(20);
        jta_Subject_Inbox.setRows(5);
        jta_Subject_Inbox.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jta_Subject_InboxMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(jta_Subject_Inbox);

        jtable_Inbox_Inbox.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Fecha", "Destinatario", "Asunto"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane2.setViewportView(jtable_Inbox_Inbox);

        jb_microphone_Inbox.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/Microphone.png"))); // NOI18N
        jb_microphone_Inbox.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jb_microphone_InboxMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 670, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel27)
                            .addComponent(jLabel26))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(cb_Recipients_Inbox, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jb_microphone_Inbox)
                                .addGap(8, 8, 8)))))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(29, 29, 29)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel26)
                            .addComponent(cb_Recipients_Inbox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jb_microphone_Inbox)))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Inbox", jPanel3);

        jta_History_History.setColumns(20);
        jta_History_History.setRows(5);
        jScrollPane3.setViewportView(jta_History_History);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 670, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 741, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("History", jPanel4);

        javax.swing.GroupLayout jd_UserLayout = new javax.swing.GroupLayout(jd_User.getContentPane());
        jd_User.getContentPane().setLayout(jd_UserLayout);
        jd_UserLayout.setHorizontalGroup(
            jd_UserLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jd_UserLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1)
                .addContainerGap())
        );
        jd_UserLayout.setVerticalGroup(
            jd_UserLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jd_UserLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jTabbedPane1)
                .addContainerGap())
        );

        jd_VoiceCall.setTitle("VOICE CALL");

        jl_Imagen_VoiceCall.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jl_Imagen_VoiceCall.setText("Imagen");

        jl_TiempoLlamada.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jl_TiempoLlamada.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jl_TiempoLlamada.setText("0:0:0");

        jLabel29.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/HangUp.png"))); // NOI18N
        jLabel29.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel29MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jd_VoiceCallLayout = new javax.swing.GroupLayout(jd_VoiceCall.getContentPane());
        jd_VoiceCall.getContentPane().setLayout(jd_VoiceCallLayout);
        jd_VoiceCallLayout.setHorizontalGroup(
            jd_VoiceCallLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jd_VoiceCallLayout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jLabel29)
                .addGap(94, 94, 94))
            .addGroup(jd_VoiceCallLayout.createSequentialGroup()
                .addGroup(jd_VoiceCallLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jd_VoiceCallLayout.createSequentialGroup()
                        .addGap(71, 71, 71)
                        .addComponent(jl_Imagen_VoiceCall, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jd_VoiceCallLayout.createSequentialGroup()
                        .addGap(150, 150, 150)
                        .addComponent(jl_TiempoLlamada, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(75, Short.MAX_VALUE))
        );
        jd_VoiceCallLayout.setVerticalGroup(
            jd_VoiceCallLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jd_VoiceCallLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jl_Imagen_VoiceCall, javax.swing.GroupLayout.PREFERRED_SIZE, 276, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jl_TiempoLlamada)
                .addGap(23, 23, 23)
                .addComponent(jLabel29, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE)
                .addContainerGap())
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("LOG IN/SIGN IN");
        setResizable(false);

        jb_microphone_LogIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/Microphone.png"))); // NOI18N
        jb_microphone_LogIn.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jb_microphone_LogInMouseClicked(evt);
            }
        });

        jt_Username_LogIn.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jt_Username_LogIn.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jt_Username_LogIn.setText("USERNAME");
        jt_Username_LogIn.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_Username_LogInMouseClicked(evt);
            }
        });

        jb_CreateAccount_LogIn.setText("CREATE ACCOUNT");
        jb_CreateAccount_LogIn.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jb_CreateAccount_LogInMouseClicked(evt);
            }
        });

        jt_Password_LogIn.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jt_Password_LogIn.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        jt_Password_LogIn.setText("PASSWORD");
        jt_Password_LogIn.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_Password_LogInMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(215, 215, 215)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jt_Password_LogIn)
                            .addComponent(jt_Username_LogIn, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE))
                        .addGap(0, 224, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jb_CreateAccount_LogIn, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jb_microphone_LogIn)))
                .addContainerGap())
        );

        layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jt_Password_LogIn, jt_Username_LogIn});

        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jb_microphone_LogIn)
                .addGap(68, 68, 68)
                .addComponent(jt_Username_LogIn, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jt_Password_LogIn, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 147, Short.MAX_VALUE)
                .addComponent(jb_CreateAccount_LogIn, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jt_Password_LogIn, jt_Username_LogIn});

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jb_CreateAccount_LogInMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jb_CreateAccount_LogInMouseClicked
        // TODO add your handling code here:
        jd_CreateAccount.setModal(false);
        jd_CreateAccount.pack();
        jd_CreateAccount.setLocationRelativeTo(this);
        jd_CreateAccount.setVisible(true);
    }//GEN-LAST:event_jb_CreateAccount_LogInMouseClicked

    private void jb_microphone_LogInMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jb_microphone_LogInMouseClicked
        // TODO add your handling code here:
        EstadoMicrofono();
    }//GEN-LAST:event_jb_microphone_LogInMouseClicked

    private void cb_Location_CreateAccountItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb_Location_CreateAccountItemStateChanged
        // TODO add your handling code here:
        String CutPhoneCode = cb_Location_CreateAccount.getSelectedItem().toString();
        int BeginIndex = 0, EndIndex = CutPhoneCode.length();

        for (int i = 0; i < CutPhoneCode.length(); i++) {
            char Revisar = CutPhoneCode.charAt(i);
            if (Revisar == '+') {
                BeginIndex = i;
            }
            if (Revisar == '/' || Revisar == '–') {
                EndIndex = i;
            }
        }

        String PhoneCode = CutPhoneCode.substring(BeginIndex, EndIndex);
        jt_PhoneNumber_CreateAccount.setText(PhoneCode);
    }//GEN-LAST:event_cb_Location_CreateAccountItemStateChanged

    private void jb_CreateAccount_CreateAccountMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jb_CreateAccount_CreateAccountMouseClicked
        // TODO add your handling code here:
        if (CamposLlenosCreateAccount()) {
            String FirstName, LastName, UserName, Contraseña, ConfirmPassword, BirthDay, Phone, Country, Genero;

            FirstName = jt_FirstName_CreateAccount.getText();
            LastName = jt_LastName_CreateAccount.getText();
            UserName = jt_Username_CreateAccount.getText();
            Contraseña = jt_Password_CreateAccount.getText();
            ConfirmPassword = jt_ConfirmPassword_CreateAccount.getText();
            BirthDay = jt_Day_CreateAccount.getText() + cb_Month_CreateAccount.getSelectedItem().toString() + jt_Year_CreateAccount.getText();
            Phone = jt_PhoneNumber_CreateAccount.getText();
            Country = cb_Location_CreateAccount.getSelectedItem().toString();
            Genero = cb_Gender_CreateAccount.getSelectedItem().toString();

            if (!UsuarioExistente(UserName) && Contraseña.equals(ConfirmPassword)) {
                Usuario NuevoUsuario = new Usuario(FirstName, LastName, UserName, Contraseña, BirthDay, Phone, Country, Genero, true);

                InsertarUsuarioEnDB(UserName, FirstName, LastName, Contraseña, BirthDay, Phone, Country, Genero);
                InsertarComandoEnDB(UserName, UserName);
                InsertarComandoEnDB(Contraseña, Contraseña);

                ListaUsuarios.add(NuevoUsuario);
                ListaComandos.add(UserName);

                EscrbirComandosEnTexto();

                LimpiarCamposCreateAccount();

                JOptionPane.showMessageDialog(jd_CreateAccount, "Usuario creado exitosamente", "OPERACION EXITOSA", JOptionPane.INFORMATION_MESSAGE);

                ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Creo un usuario", UsuarioIngresado.getUserName()));
                InsertarBitacoraEnDB(FechaBitacora.toString(), "Creo un usuario", UsuarioIngresado.getUserName());
                LlenarBitacora();

            } else if (UsuarioExistente(UserName)) {
                JOptionPane.showMessageDialog(jd_CreateAccount, "Usuario ya existente", "ERROR", JOptionPane.ERROR_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(jd_CreateAccount, "Contraseñas no coinciden", "ERROR", JOptionPane.ERROR_MESSAGE);
            }
        } else {
            JOptionPane.showMessageDialog(jd_CreateAccount, "Los campos no estan llenos", "ERROR", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_jb_CreateAccount_CreateAccountMouseClicked

    private void cb_Location_ProfileItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb_Location_ProfileItemStateChanged
        // TODO add your handling code here:
        String CutPhoneCode = cb_Location_Profile.getSelectedItem().toString();
        int BeginIndex = 0, EndIndex = CutPhoneCode.length();

        for (int i = 0; i < CutPhoneCode.length(); i++) {
            char Revisar = CutPhoneCode.charAt(i);
            if (Revisar == '+') {
                BeginIndex = i;
            }
            if (Revisar == '/' || Revisar == '–') {
                EndIndex = i;
            }
        }

        String PhoneCode = CutPhoneCode.substring(BeginIndex, EndIndex);
        jt_PhoneNumber_Profile.setText(PhoneCode);
    }//GEN-LAST:event_cb_Location_ProfileItemStateChanged

    private void cb_Location_ContactsItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cb_Location_ContactsItemStateChanged
        // TODO add your handling code here:
        String CutPhoneCode = cb_Location_Contacts.getSelectedItem().toString();
        int BeginIndex = 0, EndIndex = CutPhoneCode.length();

        for (int i = 0; i < CutPhoneCode.length(); i++) {
            char Revisar = CutPhoneCode.charAt(i);
            if (Revisar == '+') {
                BeginIndex = i;
            }
            if (Revisar == '/' || Revisar == '–') {
                EndIndex = i;
            }
        }

        String PhoneCode = CutPhoneCode.substring(BeginIndex, EndIndex);
        jt_Phone_Contacts.setText(PhoneCode);
    }//GEN-LAST:event_cb_Location_ContactsItemStateChanged

    private void jl_Imagen_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jl_Imagen_ContactsMouseClicked
        // TODO add your handling code here:
        jl_Imagen_Contacts.setText("");

        JFileChooser fc = new JFileChooser();
        FileFilter filtro = new FileNameExtensionFilter("Imagenes", "png", "jpg", "jpeg", "gif");
        fc.setFileFilter(filtro);

        File Archivo;
        int op = fc.showOpenDialog(this);

        if (op == JFileChooser.APPROVE_OPTION) {
            Archivo = fc.getSelectedFile();
            RutaImagen = Archivo.getPath();
            System.out.println(Archivo.getPath());
            Image Img = Toolkit.getDefaultToolkit().createImage(Archivo.getPath()).getScaledInstance(180, 229, 0);
            this.jl_Imagen_Contacts.setIcon(new ImageIcon(Img));
        }
    }//GEN-LAST:event_jl_Imagen_ContactsMouseClicked

    private void jt_Username_LogInMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_Username_LogInMouseClicked
        // TODO add your handling code here:
        ReconocedorLogIn(jt_Username_LogIn);
    }//GEN-LAST:event_jt_Username_LogInMouseClicked

    private void jt_Password_LogInMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_Password_LogInMouseClicked
        // TODO add your handling code here:
        ReconocedorLogIn(jt_Password_LogIn);
    }//GEN-LAST:event_jt_Password_LogInMouseClicked

    private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked
        // TODO add your handling code here:
        if (CamposLlenosProfile() && UsuarioIngresado.getUserName().equals(jt_Username_Profile.getText())) {
            String FirstName, LastName, UserName, Contraseña, ConfirmPassword, BirthDay, Phone, Country, Genero;

            FirstName = jt_FirstName_Profile.getText();
            LastName = jt_LastName_Profile.getText();
            UserName = jt_Username_Profile.getText();
            Contraseña = jt_Password_Profile.getText();
            ConfirmPassword = jt_ConfirmPassword_Profile.getText();
            BirthDay = jt_Day_Profile.getText() + cb_Month_CreateAccount.getSelectedItem().toString() + jt_Year_CreateAccount.getText();
            Phone = jt_PhoneNumber_Profile.getText();
            Country = cb_Location_Profile.getSelectedItem().toString();
            Genero = cb_Gender_Profile.getSelectedItem().toString();

            for (int i = 0; i < ListaComandos.size(); i++) {
                if (UsuarioIngresado.getContraseña().equals(ListaComandos.get(i))) {
                    ListaComandos.remove(i);
                    ListaComandos.add(UserName);

                    ActualizarComandoEnDB(UserName, UsuarioIngresado.getUserName());
                }

                if (UsuarioIngresado.getUserName().equals(ListaComandos.get(i))) {
                    ListaComandos.remove(i);
                    ListaComandos.add(Contraseña);

                    ActualizarComandoEnDB(Contraseña, UsuarioIngresado.getContraseña());
                }
            }

            for (int i = 0; i < ListaUsuarios.size(); i++) {
                if (UsuarioIngresado.getUserName().equals(ListaUsuarios.get(i).getUserName())) {
                    ActualizarUsuarioEnDB(UserName, FirstName, LastName, Contraseña, BirthDay, Phone, Country, Genero);
                    ListaUsuarios.get(i).setBirthDay(BirthDay);
                    ListaUsuarios.get(i).setContraseña(Contraseña);
                    ListaUsuarios.get(i).setCountry(Country);
                    ListaUsuarios.get(i).setFirstName(FirstName);
                    ListaUsuarios.get(i).setGenero(Genero);
                    ListaUsuarios.get(i).setLastName(LastName);
                    ListaUsuarios.get(i).setPhone(Phone);
                    ListaUsuarios.get(i).setUserName(UserName);
                    UsuarioIngresado = ListaUsuarios.get(i);
                }
            }

            EscrbirComandosEnTexto();

            ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "actualizo un usuario", UsuarioIngresado.getUserName()));
            InsertarBitacoraEnDB(FechaBitacora.toString(), "actualizo un usuario", UsuarioIngresado.getUserName());
            LlenarBitacora();

            JOptionPane.showMessageDialog(jd_User, "Usuario actualizado exitosamente", "OPERACION EXITOSA", JOptionPane.INFORMATION_MESSAGE);
        } else {
            JOptionPane.showMessageDialog(jd_User, "Usuario actualizado exitosamente", "OPERACION EXITOSA", JOptionPane.INFORMATION_MESSAGE);
        }
    }//GEN-LAST:event_jButton3MouseClicked

    private void jt_Name_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_Name_ContactsMouseClicked
        // TODO add your handling code here:
        ReconocedorContacts(jt_Name_Contacts);
    }//GEN-LAST:event_jt_Name_ContactsMouseClicked

    private void jt_NickName_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_NickName_ContactsMouseClicked
        // TODO add your handling code here:
        ReconocedorContacts(jt_NickName_Contacts);
    }//GEN-LAST:event_jt_NickName_ContactsMouseClicked

    private void jt_Phone_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_Phone_ContactsMouseClicked
        // TODO add your handling code here:
        ReconocedorContacts(jt_Phone_Contacts);
    }//GEN-LAST:event_jt_Phone_ContactsMouseClicked

    private void jt_Day_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_Day_ContactsMouseClicked
        // TODO add your handling code here:
        ReconocedorContacts(jt_Day_Contacts);
    }//GEN-LAST:event_jt_Day_ContactsMouseClicked

    private void jt_Year_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_Year_ContactsMouseClicked
        // TODO add your handling code here:
        ReconocedorContacts(jt_Year_Contacts);
    }//GEN-LAST:event_jt_Year_ContactsMouseClicked

    private void jt_PhoneticName_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_PhoneticName_ContactsMouseClicked
        // TODO add your handling code here:
        ReconocedorContacts(jt_PhoneticName_Contacts);
    }//GEN-LAST:event_jt_PhoneticName_ContactsMouseClicked

    private void jt_Email_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jt_Email_ContactsMouseClicked
        // TODO add your handling code here:
        ReconocedorContacts(jt_Email_Contacts);
    }//GEN-LAST:event_jt_Email_ContactsMouseClicked

    private void jb_microphone_ContactsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jb_microphone_ContactsMouseClicked
        // TODO add your handling code here:
        EstadoMicrofono();
    }//GEN-LAST:event_jb_microphone_ContactsMouseClicked

    private void jta_Subject_InboxMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jta_Subject_InboxMouseClicked
        // TODO add your handling code here:
        ReconocedorMensaje(jta_Subject_Inbox);
    }//GEN-LAST:event_jta_Subject_InboxMouseClicked

    private void jb_microphone_InboxMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jb_microphone_InboxMouseClicked
        // TODO add your handling code here:
        EstadoMicrofono();
    }//GEN-LAST:event_jb_microphone_InboxMouseClicked

    private void jLabel29MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel29MouseClicked
        // TODO add your handling code here:
        jd_VoiceCall.dispose();
    }//GEN-LAST:event_jLabel29MouseClicked

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                /*if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }*/
                UIManager.setLookAndFeel("com.jtattoo.plaf.hifi.HiFiLookAndFeel");
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Principal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox<String> cb_Gender_CreateAccount;
    private javax.swing.JComboBox<String> cb_Gender_Profile;
    private javax.swing.JComboBox<String> cb_Location_Contacts;
    private javax.swing.JComboBox<String> cb_Location_CreateAccount;
    private javax.swing.JComboBox<String> cb_Location_Profile;
    private javax.swing.JComboBox<String> cb_Month_Contacts;
    private javax.swing.JComboBox<String> cb_Month_CreateAccount;
    private javax.swing.JComboBox<String> cb_Month_Profile;
    private javax.swing.JComboBox<Object> cb_Recipients_Inbox;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JButton jb_CreateAccount_CreateAccount;
    private javax.swing.JButton jb_CreateAccount_LogIn;
    private javax.swing.JButton jb_microphone_Contacts;
    private javax.swing.JButton jb_microphone_Inbox;
    private javax.swing.JButton jb_microphone_LogIn;
    private javax.swing.JDialog jd_CreateAccount;
    private javax.swing.JDialog jd_User;
    private javax.swing.JDialog jd_VoiceCall;
    private javax.swing.JLabel jl_Imagen_Contacts;
    private javax.swing.JLabel jl_Imagen_VoiceCall;
    private javax.swing.JLabel jl_TiempoLlamada;
    private javax.swing.JPasswordField jt_ConfirmPassword_CreateAccount;
    private javax.swing.JPasswordField jt_ConfirmPassword_Profile;
    private javax.swing.JTextField jt_Day_Contacts;
    private javax.swing.JTextField jt_Day_CreateAccount;
    private javax.swing.JTextField jt_Day_Profile;
    private javax.swing.JTextField jt_Email_Contacts;
    private javax.swing.JTextField jt_FirstName_CreateAccount;
    private javax.swing.JTextField jt_FirstName_Profile;
    private javax.swing.JTextField jt_LastName_CreateAccount;
    private javax.swing.JTextField jt_LastName_Profile;
    private javax.swing.JTextField jt_Name_Contacts;
    private javax.swing.JTextField jt_NickName_Contacts;
    private javax.swing.JPasswordField jt_Password_CreateAccount;
    private javax.swing.JPasswordField jt_Password_LogIn;
    private javax.swing.JPasswordField jt_Password_Profile;
    private javax.swing.JTextField jt_PhoneNumber_CreateAccount;
    private javax.swing.JTextField jt_PhoneNumber_Profile;
    private javax.swing.JTextField jt_Phone_Contacts;
    private javax.swing.JTextField jt_PhoneticName_Contacts;
    private javax.swing.JTextField jt_Username_CreateAccount;
    private javax.swing.JTextField jt_Username_LogIn;
    private javax.swing.JTextField jt_Username_Profile;
    private javax.swing.JTextField jt_Year_Contacts;
    private javax.swing.JTextField jt_Year_CreateAccount;
    private javax.swing.JTextField jt_Year_Profile;
    private javax.swing.JTextArea jta_History_History;
    private javax.swing.JTextArea jta_Subject_Inbox;
    private javax.swing.JTable jtable_Inbox_Inbox;
    // End of variables declaration//GEN-END:variables
    Recognizer recognizer;
    String gst = "";
    String Palabra = "", PalabraAnterior = "";
    Escucha GPalabra = new Escucha(Palabra);
    int CambiarIconoMicrofono = 0;
    Connection Conect = null;

    String RutaImagen = "";
    Date FechaBitacora = new Date();

    ArrayList<Usuario> ListaUsuarios = new ArrayList();
    ArrayList<Contacto> ListaContactos = new ArrayList();
    ArrayList<Mensaje> ListaMensajes = new ArrayList();
    ArrayList<Bitacora> ListaBitacoras = new ArrayList();
    ArrayList<String> ListaComandos = new ArrayList();
    ArrayList<JTextField> ListaJTextFields = new ArrayList();
    ArrayList<JButton> Botones = new ArrayList();

    Usuario UsuarioIngresado = new Usuario("", "", "No hay usuario ingresado", "", "", "", "", "", false);

    public void InsertarUsuarioEnDB(String UserName, String FirstName, String LastName, String Contraseña, String BirthDay, String Phone, String Country, String Genero) {
        System.out.println(Contraseña + " " + Genero);

        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call AgregarUsuario(?, ?, ?, ?, ?, ?, ?, ?)}");
            CT.setString("UserName", UserName);
            CT.setString("FirstName", FirstName);
            CT.setString("LastName", LastName);
            CT.setString("Contraseña", Contraseña);
            CT.setString("BirthDay", BirthDay);
            CT.setString("Phone", Phone);
            CT.setString("Country", Country);
            CT.setString("Genero", Genero);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void ActualizarUsuarioEnDB(String UserName, String FirstName, String LastName, String Contraseña, String BirthDay, String Phone, String Country, String Genero) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call ActualizarUsuario(?, ?, ?, ?, ?, ?, ?, ?)}");
            CT.setString("UserName", UserName);
            CT.setString("FirstName", FirstName);
            CT.setString("LastName", LastName);
            CT.setString("Contraseña", Contraseña);
            CT.setString("BirthDay", BirthDay);
            CT.setString("Phone", Phone);
            CT.setString("Country", Country);
            CT.setString("Genero", Genero);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void EliminarUsuarioEnDB(String UserName) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call EliminarUsuario(?)}");
            CT.setString("UserName", UserName);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public ArrayList<Usuario> ListaUsuarios() {
        CallableStatement CT = null;
        ResultSet RS = null;
        try {
            CT = Conect.prepareCall("{Call ListarUsuario}");
            RS = CT.executeQuery();
            Usuario NuevoUsuario = null;
            while (RS.next()) {
                NuevoUsuario = new Usuario();
                NuevoUsuario.setUserName(RS.getString("UserName"));
                NuevoUsuario.setFirstName(RS.getString("FirstName"));
                NuevoUsuario.setLastName(RS.getString("LastName"));
                NuevoUsuario.setContraseña(RS.getString("Contraseña"));
                NuevoUsuario.setBirthDay(RS.getString("BirthDay"));
                NuevoUsuario.setPhone(RS.getString("Phone"));
                NuevoUsuario.setCountry(RS.getString("Country"));
                NuevoUsuario.setGenero(RS.getString("Genero"));
                ListaUsuarios.add(NuevoUsuario);
            }
        } catch (Exception e) {
        }
        return ListaUsuarios;
    }

    //---------------------------------------------------------------------------------------------------------
    public void InsertarContactoEnDB(String Name, String PhoneticName, String NickName, String RutaImagen, String Phone, String PhonePlace, String BirthDay, String NombreUsuarioPertenece, String Email) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call AgregarContacto(?, ?, ?, ?, ?, ?, ?, ?, ?)}");
            CT.setString("Nombre", Name);
            CT.setString("PhoneticName", PhoneticName);
            CT.setString("NickName", NickName);
            CT.setString("RutaImagen", RutaImagen);
            CT.setString("Phone", Phone);
            CT.setString("PhonePlace", PhonePlace);
            CT.setString("BirthDay", BirthDay);
            CT.setString("NombreUsuarioPertenece", NombreUsuarioPertenece);
            CT.setString("Email", Email);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void ActualizarContactoEnDB(String Name, String PhoneticName, String NickName, String RutaImagen, String Phone, String PhonePlace, String BirthDay, String NombreUsuarioPertenece, String Email) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call ActualizarContacto(?, ?, ?, ?, ?, ?, ?, ?, ?)}");
            CT.setString("Nombre", Name);
            CT.setString("PhoneticName", PhoneticName);
            CT.setString("NickName", NickName);
            CT.setString("RutaImagen", RutaImagen);
            CT.setString("Phone", Phone);
            CT.setString("PhonePlace", PhonePlace);
            CT.setString("BirthDay", BirthDay);
            CT.setString("NombreUsuarioPertenece", NombreUsuarioPertenece);
            CT.setString("Email", Email);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void EliminarContactoEnDB(String Phone) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call EliminarContacto(?)}");
            CT.setString("Phone", Phone);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public ArrayList<Contacto> ListaContactos() {
        CallableStatement CT = null;
        ResultSet RS = null;
        try {
            CT = Conect.prepareCall("{Call ListarContacto}");
            RS = CT.executeQuery();
            Contacto NuevoContacto = null;
            while (RS.next()) {
                NuevoContacto = new Contacto();
                NuevoContacto.setName(RS.getString("Nombre"));
                NuevoContacto.setPhoneticName(RS.getString("PhoneticName"));
                NuevoContacto.setNickName(RS.getString("NickName"));
                NuevoContacto.setRutaImagen(RS.getString("RutaImagen"));
                NuevoContacto.setPhone(RS.getString("Phone"));
                NuevoContacto.setPhonePlace(RS.getString("PhonePlace"));
                NuevoContacto.setBirthDay(RS.getString("BirthDay"));
                NuevoContacto.setNombreUsuarioPertenece(RS.getString("NombreUsuarioPertenece"));
                NuevoContacto.setEmail(RS.getString("Email"));

                ListaContactos.add(NuevoContacto);
            }
        } catch (Exception e) {
        }
        return ListaContactos;
    }

    //----------------------------------------------------------------------------------------------------------
    public void InsertarMensajeEnDB(String Fecha, String Asunto, String Destinatario, String NombreUsuarioPertenece) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call AgregarMensaje(?, ?, ?, ?)}");
            CT.setString("Fecha", Fecha);
            CT.setString("Asunto", Asunto);
            CT.setString("Destinatario", Destinatario);
            CT.setString("NombreUsuarioPertenece", NombreUsuarioPertenece);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void EliminarMensajeEnDB(String Fecha) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call EliminarMensaje(?)}");
            CT.setString("Fecha", Fecha);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public ArrayList<Mensaje> ListaMensajes() {
        CallableStatement CT = null;
        ResultSet RS = null;
        try {
            CT = Conect.prepareCall("{Call ListarMensaje}");
            RS = CT.executeQuery();
            Mensaje NuevoMensaje;
            while (RS.next()) {
                NuevoMensaje = new Mensaje();
                NuevoMensaje.setFecha(RS.getString("Fecha"));
                NuevoMensaje.setAsunto(RS.getString("Asunto"));
                NuevoMensaje.setDestinatario(RS.getString("Destinatario"));
                NuevoMensaje.setNombreUsuarioPertenece(RS.getString("NombreUsuarioPertenece"));
                ListaMensajes.add(NuevoMensaje);
            }
        } catch (Exception e) {
        }
        return ListaMensajes;
    }

    //----------------------------------------------------------------------------------------------------------
    public void InsertarBitacoraEnDB(String Fecha, String Accion, String NombreUsuarioPertenece) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            CT = Conect.prepareCall("{Call AgregarBitacora(?, ?, ?)}");
            CT.setString("Fecha", Fecha);
            CT.setString("Accion", Accion);
            CT.setString("NombreUsuarioPertenece", NombreUsuarioPertenece);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public ArrayList<Bitacora> ListaBitacoras() {
        CallableStatement CT = null;
        ResultSet RS = null;
        try {
            CT = Conect.prepareCall("{Call ListarBitacora}");
            RS = CT.executeQuery();
            Bitacora NuevaBitacora;
            while (RS.next()) {
                NuevaBitacora = new Bitacora();
                NuevaBitacora.setFecha(RS.getString("Fecha"));
                NuevaBitacora.setAccion(RS.getString("accion"));
                NuevaBitacora.setNombreUsuarioPertenece(RS.getString("NombreUsuarioPertenece"));
                ListaBitacoras.add(NuevaBitacora);
            }
        } catch (Exception e) {
        }
        return ListaBitacoras;
    }

    //----------------------------------------------------------------------------------------------------------
    public void InsertarComandoEnDB(String Comandos, String Comandos2) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call AgregarComando(?, ?)}");
            CT.setString("Comandos", Comandos);
            CT.setString("Comandos2", Comandos2);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void ActualizarComandoEnDB(String Comando, String Comandos2) {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call ActualizarComando(?, ?)}");
            CT.setString("Comandos", Comando);
            CT.setString("Comandos2", Comandos2);
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void EliminarComando() {
        CallableStatement CT = null;
        boolean Resp = true;
        try {
            Conect.setAutoCommit(false);
            CT = Conect.prepareCall("{Call EliminarComando}");
            Resp = CT.execute();
            Conect.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public ArrayList<String> ListaComando() {
        CallableStatement CT = null;
        ResultSet RS = null;
        try {
            CT = Conect.prepareCall("{Call ListarComando}");
            RS = CT.executeQuery();
            String NuevoComando;
            while (RS.next()) {
                NuevoComando = "";
                NuevoComando = RS.getString("Comandos");
                ListaComandos.add(NuevoComando);
            }
        } catch (Exception e) {
        }
        return ListaComandos;
    }
    //----------------------------------------------------------------------------------------------------------

    public boolean RevisarContraseñaYUsuario(String Usuario, String Contraseña) {
        int Contador = 0;
        for (int i = 0; i < ListaUsuarios.size(); i++) {
            if (ListaUsuarios.get(i).getUserName().equals(Usuario) && ListaUsuarios.get(i).getContraseña().equals(Contraseña)) {
                Contador++;
            }
        }

        if (Contador == 1) {
            return true;
        } else {
            return false;
        }
    }

    public boolean UsuarioExistente(String Username) {
        int NumeroRepetidos = 0;
        for (int i = 0; i < ListaUsuarios.size(); i++) {
            if (ListaUsuarios.get(i).getUserName().equals(Username)) {
                NumeroRepetidos++;
            }
        }

        if (NumeroRepetidos == 0) {
            return false;
        } else {
            return true;
        }
    }

    public boolean TelefonoExistente(String Phone) {
        int NumeroRepetidos = 0;

        for (int i = 0; i < ListaContactos.size(); i++) {
            if (ListaContactos.get(i).getPhone().equals(Phone)) {
                NumeroRepetidos++;
            }
        }

        if (NumeroRepetidos == 0) {
            return false;
        } else {
            return true;
        }
    }

    public boolean CamposLlenosLogIn() {
        if (!jt_Username_LogIn.getText().equals("") && !jt_Password_LogIn.getText().equals("")) {
            return true;
        } else {
            return false;
        }
    }

    public boolean CamposLlenosCreateAccount() {
        if (!jt_FirstName_CreateAccount.getText().equals("") && !jt_LastName_CreateAccount.getText().equals("") && !jt_Username_CreateAccount.getText().equals("")
                && !jt_Password_CreateAccount.getText().equals("") && !jt_ConfirmPassword_CreateAccount.getText().equals("") && !jt_PhoneNumber_CreateAccount.getText().equals("")) {
            return true;
        } else {
            return false;
        }
    }

    public boolean CamposLlenosProfile() {
        if (!jt_FirstName_Profile.getText().equals("") && !jt_LastName_Profile.getText().equals("") && !jt_Username_Profile.getText().equals("")
                && !jt_Password_Profile.getText().equals("") && !jt_ConfirmPassword_Profile.getText().equals("") && !jt_PhoneNumber_Profile.getText().equals("")) {
            return true;
        } else {
            return false;
        }
    }

    public boolean CamposLlenosContact() {
        if (!jt_Name_Contacts.getText().equals("") && !jt_NickName_Contacts.getText().equals("") && !jt_Phone_Contacts.getText().equals("")
                && !jt_PhoneticName_Contacts.getText().equals("") && !jt_Email_Contacts.getText().equals("")
                && !"".equals(RutaImagen)) {
            return true;
        } else {
            return false;
        }
    }

    public boolean CamposLlenosMensaje() {
        if (!jta_Subject_Inbox.getText().equals("")) {
            return true;
        } else {
            return false;
        }
    }

    public void LlenarComboDeContactos() {
        cb_Recipients_Inbox.removeAllItems();

        for (int i = 0; i < ListaContactos.size(); i++) {
            if (ListaContactos.get(i).getNombreUsuarioPertenece().equals(UsuarioIngresado.getUserName())) {
                cb_Recipients_Inbox.addItem(ListaContactos.get(i));
            }
        }
    }

    public void LlenarInbox() {
        DefaultTableModel ModeloTabla = (DefaultTableModel) jtable_Inbox_Inbox.getModel();

        while (ModeloTabla.getRowCount() > 0) {
            ModeloTabla.removeRow(0);
        }

        for (int i = 0; i < ListaMensajes.size(); i++) {
            if (ListaMensajes.get(i).getNombreUsuarioPertenece().equals(UsuarioIngresado.getUserName())) {
                String[] Row = {ListaMensajes.get(i).getFecha(), ListaMensajes.get(i).getDestinatario(), ListaMensajes.get(i).getAsunto()};
                ModeloTabla.addRow(Row);
            }
        }

        jtable_Inbox_Inbox.setModel(ModeloTabla);

        jtable_Inbox_Inbox.setModel(ModeloTabla);
    }

    public void EstadoMicrofono() {
        if (CambiarIconoMicrofono == 0) {
            for (int i = 0; i < Botones.size(); i++) {
                Botones.get(i).setIcon(new ImageIcon(getClass().getResource("/Iconos/stopMicrophone.png")));
            }

            PalabraAnterior = Palabra;
            CambiarIconoMicrofono++;
            try {
                recognizer.resume();
            } catch (AudioException ex) {
                Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
            } catch (EngineStateError ex) {
                Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
            }

            ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Encendio el microfono", UsuarioIngresado.getUserName()));
            InsertarBitacoraEnDB(FechaBitacora.toString(), "Encendio el microfono", UsuarioIngresado.getUserName());
            LlenarBitacora();

        } else if (CambiarIconoMicrofono == 1) {
            for (int i = 0; i < Botones.size(); i++) {
                Botones.get(i).setIcon(new ImageIcon(getClass().getResource("/Iconos/Microphone.png")));
            }

            CambiarIconoMicrofono--;
            recognizer.pause();

            ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Apago el microfono", UsuarioIngresado.getUserName()));
            InsertarBitacoraEnDB(FechaBitacora.toString(), "Apago el microfono", UsuarioIngresado.getUserName());
            LlenarBitacora();

        }
    }

    public void EscrbirComandosEnTexto() {
        FileWriter fichero = null;
        PrintWriter pw = null;
        try {
            fichero = new FileWriter("./Gramatica.txt");
            pw = new PrintWriter(fichero);

            pw.println("#JSGF V1.0;");
            pw.println("grammar sentence;");
            pw.println("");
            pw.println("public <sentence> =");

            for (int i = 0; i < ListaComandos.size(); i++) {
                if (i == ListaComandos.size() - 1) {
                    pw.print("[<dato" + i + ">];");
                } else {
                    pw.println("[<dato" + i + ">]");
                }
            }

            pw.println("");
            pw.println("");

            for (int i = 0; i < ListaComandos.size(); i++) {
                if (i == ListaComandos.size() - 1) {
                    pw.print("<dato" + i + ">=" + ListaComandos.get(i) + ";");
                } else {
                    pw.println("<dato" + i + ">=" + ListaComandos.get(i) + ";");
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (null != fichero) {
                    fichero.close();
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
    }

    public void LlenarBitacora() {
        jta_History_History.setText("");

        String Bitacora = "";
        for (int i = 0; i < ListaBitacoras.size(); i++) {
            Bitacora += ListaBitacoras.get(i).toString();
        }

        jta_History_History.setText(Bitacora);
    }

    public void ReconocedorLogIn(JTextField TextFieldActual) {
        Palabra = GPalabra.getGst();
        if (!"".equals(Palabra)) {
            int answer = JOptionPane.showConfirmDialog(jd_User, "¿Quisiste decir " + Palabra + "?");
            if (Palabra.equals("login") && CamposLlenosLogIn()) {
                if (RevisarContraseñaYUsuario(jt_Username_LogIn.getText(), jt_Password_LogIn.getText()) && answer == JOptionPane.YES_OPTION) {
                    jd_User.setModal(false);
                    jd_User.pack();
                    jd_User.setLocationRelativeTo(this);
                    jd_User.setVisible(true);

                    for (int i = 0; i < ListaUsuarios.size(); i++) {
                        if (jt_Username_LogIn.getText().equals(ListaUsuarios.get(i).getUserName())) {
                            UsuarioIngresado = ListaUsuarios.get(i);
                        }
                    }

                    LimpiarCamposLogIn();
                    LlenarCamposProfile();
                    LlenarComboDeContactos();

                    ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Usuario inicio sesion", UsuarioIngresado.getUserName()));
                    InsertarBitacoraEnDB(FechaBitacora.toString(), "Usuario inicio sesion", UsuarioIngresado.getUserName());
                    LlenarBitacora();

                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");

                } else if (!RevisarContraseñaYUsuario(jt_Username_LogIn.getText(), jt_Password_LogIn.getText()) && answer == JOptionPane.YES_OPTION) {
                    JOptionPane.showMessageDialog(this, "Usuario o contraseña incorrectas", "ERROR", JOptionPane.ERROR_MESSAGE);
                    LimpiarCamposLogIn();
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (Palabra.equals("exit")) {
                if (answer == JOptionPane.YES_OPTION) {
                    ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "cerro el programa", UsuarioIngresado.getUserName()));
                    InsertarBitacoraEnDB(FechaBitacora.toString(), "cerro el programa", UsuarioIngresado.getUserName());
                    LlenarBitacora();

                    System.exit(0);
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (!Palabra.equals("login") && !Palabra.equals("exit")) {
                if (answer == JOptionPane.YES_OPTION) {
                    TextFieldActual.setText(Palabra);
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                } else if (answer == JOptionPane.NO_OPTION) {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            }
        }
    }

    public void ReconocedorMensaje(JTextArea TextAreaActual) {
        Palabra = GPalabra.getGst();
        if (!"".equals(Palabra)) {
            int answer = JOptionPane.showConfirmDialog(jd_User, "¿Quisiste decir " + Palabra + "?");
            if (answer == JOptionPane.YES_OPTION && Palabra.equals("send")) {
                String Mensaje = TextAreaActual.getText();
                Date FechaActual = new Date();
                String Destinatario = ((Contacto) cb_Recipients_Inbox.getSelectedItem()).getName() + " " + ((Contacto) cb_Recipients_Inbox.getSelectedItem()).getPhone();

                Mensaje NuevoMensaje = new Mensaje(FechaActual.toString(), Mensaje, Destinatario, UsuarioIngresado.getUserName(), true);
                ListaMensajes.add(NuevoMensaje);
                InsertarMensajeEnDB(FechaActual.toString(), Mensaje, Destinatario, UsuarioIngresado.getUserName());

                TextAreaActual.setText("");
                LlenarInbox();

                ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Envio un mensaje", UsuarioIngresado.getUserName()));
                InsertarBitacoraEnDB(FechaBitacora.toString(), "Envio un mensaje", UsuarioIngresado.getUserName());
                LlenarBitacora();

                JOptionPane.showMessageDialog(jd_User, "Mensaje enviado exitosamente", "OPERACION EXITOSA", JOptionPane.INFORMATION_MESSAGE);
                Palabra = "";
                PalabraAnterior = "";
                GPalabra.setGst("");
            } else {
                Palabra = "";
                PalabraAnterior = "";
                GPalabra.setGst("");
            }
        }
    }

    public void ReconocedorContacts(JTextField TextFieldActual) {
        Palabra = GPalabra.getGst();
        if (!"".equals(Palabra)) {
            int answer = JOptionPane.showConfirmDialog(jd_User, "¿Quisiste decir " + Palabra + "?");
            if (Palabra.equals("add")) {
                if (answer == JOptionPane.YES_OPTION) {
                    String Name, PhoneticName, NickName, Phone, PhonePlace, Email, BirthDay, NombreUsuarioPertenece;
                    Name = jt_Name_Contacts.getText();
                    PhoneticName = jt_PhoneticName_Contacts.getText();
                    NickName = jt_NickName_Contacts.getText();
                    Phone = jt_Phone_Contacts.getText();
                    BirthDay = jt_Day_Contacts.getText() + cb_Month_Contacts.getSelectedItem().toString() + jt_Year_Contacts.getText();
                    NombreUsuarioPertenece = UsuarioIngresado.getUserName();
                    PhonePlace = cb_Location_Contacts.getSelectedItem().toString();
                    Email = jt_Email_Contacts.getText();
                    if (CamposLlenosContact()) {
                        Contacto NuevoContacto = new Contacto(Name, PhoneticName, NickName, RutaImagen, Phone, PhonePlace, Email, BirthDay, NombreUsuarioPertenece, true);
                        ListaContactos.add(NuevoContacto);
                        ListaComandos.add(Name);
                        EscrbirComandosEnTexto();

                        InsertarContactoEnDB(Name, PhoneticName, NickName, RutaImagen, Phone, PhonePlace, BirthDay, NombreUsuarioPertenece, Email);
                        InsertarComandoEnDB(Name, Name);

                        LlenarComboDeContactos();
                        LimpiarCamposContacts();

                        ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Agrego un contacto", UsuarioIngresado.getUserName()));
                        InsertarBitacoraEnDB(FechaBitacora.toString(), "Agrego un contacto", UsuarioIngresado.getUserName());
                        LlenarBitacora();

                        JOptionPane.showMessageDialog(jd_User, "Contacto agregado exitosamente", "OPERACION EXITOSA", JOptionPane.INFORMATION_MESSAGE);

                        Palabra = "";
                        PalabraAnterior = "";
                        GPalabra.setGst("");
                    } else {
                        JOptionPane.showMessageDialog(jd_User, "Llene todos los campos", "OPERACION EXITOSA", JOptionPane.ERROR_MESSAGE);

                        Palabra = "";
                        PalabraAnterior = "";
                        GPalabra.setGst("");
                    }
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (Palabra.equals("exit")) {
                if (answer == JOptionPane.YES_OPTION) {
                    System.exit(0);
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (Palabra.equals("delete")) {
                if (answer == JOptionPane.YES_OPTION) {
                    if (CamposLlenosContact()) {
                        String Phone, Name;
                        Phone = jt_Phone_Contacts.getText();
                        Name = jt_Name_Contacts.getText();
                        int Borrado = 0;

                        for (int i = 0; i < ListaContactos.size(); i++) {
                            if (ListaContactos.get(i).getPhone().endsWith(Phone)) {
                                ListaContactos.remove(i);
                            }
                        }

                        for (int i = 0; i < ListaComandos.size(); i++) {
                            if (ListaComandos.get(i).equals(Name) && Borrado == 0) {
                                ListaComandos.remove(i);
                                Borrado++;
                            }
                        }

                        EliminarContactoEnDB(Phone);
                        EliminarComando();

                        for (int i = 0; i < ListaComandos.size(); i++) {
                            InsertarComandoEnDB(ListaComandos.get(i), ListaComandos.get(i));
                        }

                        LlenarComboDeContactos();
                        EscrbirComandosEnTexto();

                        ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Elimino un contacto", UsuarioIngresado.getUserName()));
                        InsertarBitacoraEnDB(FechaBitacora.toString(), "Elimino un contacto", UsuarioIngresado.getUserName());
                        LlenarBitacora();

                        JOptionPane.showMessageDialog(jd_User, "Contacto eliminado exitosamente", "OPERACION EXITOSA", JOptionPane.INFORMATION_MESSAGE);

                        Palabra = "";
                        PalabraAnterior = "";
                        GPalabra.setGst("");
                    } else {
                        JOptionPane.showMessageDialog(jd_User, "Llene todos los campos", "OPERACION EXITOSA", JOptionPane.ERROR_MESSAGE);

                        Palabra = "";
                        PalabraAnterior = "";
                        GPalabra.setGst("");
                    }
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (Palabra.equals("update") || Palabra.equals("modify")) {
                if (answer == JOptionPane.YES_OPTION) {
                    String Name, PhoneticName, NickName, Phone, PhonePlace, Email, BirthDay, NombreUsuarioPertenece;
                    Name = jt_Name_Contacts.getText();
                    PhoneticName = jt_PhoneticName_Contacts.getText();
                    NickName = jt_NickName_Contacts.getText();
                    Phone = jt_Phone_Contacts.getText();
                    BirthDay = jt_Day_Contacts.getText() + cb_Month_Contacts.getSelectedItem().toString() + jt_Year_Contacts.getText();
                    NombreUsuarioPertenece = UsuarioIngresado.getUserName();
                    PhonePlace = cb_Location_Contacts.getSelectedItem().toString();
                    Email = jt_Email_Contacts.getText();

                    int Existe = 0;
                    int Indice = 0;

                    for (int i = 0; i < ListaContactos.size(); i++) {
                        if (ListaContactos.get(i).getPhone().equals(Phone)) {
                            Existe++;
                            Indice = i;
                        }
                    }

                    if (Existe > 0) {
                        int Borrado = 0;
                        for (int i = 0; i < ListaComandos.size(); i++) {
                            if (ListaComandos.get(i).equals(ListaContactos.get(Indice).getName()) && Borrado == 0) {
                                ListaComandos.remove(i);
                                Borrado++;
                            }
                        }

                        EliminarComando();

                        for (int i = 0; i < ListaContactos.size(); i++) {
                            if (ListaContactos.get(i).getPhone().equals(Phone)) {
                                ListaContactos.get(i).setBirthDay(BirthDay);
                                ListaContactos.get(i).setEmail(Email);
                                ListaContactos.get(i).setName(Name);
                                ListaContactos.get(i).setNickName(NickName);
                                ListaContactos.get(i).setPhonePlace(PhonePlace);
                                ListaContactos.get(i).setPhoneticName(PhoneticName);
                                ListaContactos.get(i).setRutaImagen(RutaImagen);
                            }
                        }

                        ListaComandos.add(Name);
                        for (int i = 0; i < ListaComandos.size(); i++) {
                            InsertarComandoEnDB(ListaComandos.get(i), ListaComandos.get(i));
                        }

                        ActualizarContactoEnDB(Name, PhoneticName, NickName, RutaImagen, Phone, PhonePlace, BirthDay, NombreUsuarioPertenece, Email);
                        EscrbirComandosEnTexto();

                        LlenarComboDeContactos();

                        ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Actualizo un contacto", UsuarioIngresado.getUserName()));
                        InsertarBitacoraEnDB(FechaBitacora.toString(), "Actualizo un contacto", UsuarioIngresado.getUserName());
                        LlenarBitacora();

                        JOptionPane.showMessageDialog(jd_User, "Contacto actualizado exitosamente", "OPERACION EXITOSA", JOptionPane.INFORMATION_MESSAGE);

                        Palabra = "";
                        PalabraAnterior = "";
                        GPalabra.setGst("");
                    } else {
                        JOptionPane.showMessageDialog(jd_User, "Numero de telefono inexistente", "ERROR", JOptionPane.ERROR_MESSAGE);

                        Palabra = "";
                        PalabraAnterior = "";
                        GPalabra.setGst("");
                    }
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (Palabra.equals("search")) {
                if (answer == JOptionPane.YES_OPTION) {

                    ReconocedorSearch(TextFieldActual);

                    ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "Se busco un contacto", UsuarioIngresado.getUserName()));
                    InsertarBitacoraEnDB(FechaBitacora.toString(), "Se busco un contacto", UsuarioIngresado.getUserName());
                    LlenarBitacora();

                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (Palabra.equals("voicecall")) {
                if (answer == JOptionPane.YES_OPTION) {

                    ReconocedorSearch(TextFieldActual);

                    ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "hizo una llamada", UsuarioIngresado.getUserName()));
                    InsertarBitacoraEnDB(FechaBitacora.toString(), "hizo una llamada", UsuarioIngresado.getUserName());
                    LlenarBitacora();

                    Hilo secs = new Hilo(jl_TiempoLlamada);
                    Thread proceso = new Thread(secs);
                    proceso.start();

                    jd_VoiceCall.setModal(false);
                    jd_VoiceCall.pack();
                    jd_VoiceCall.setLocationRelativeTo(this);
                    jd_VoiceCall.setVisible(true);

                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else if (Palabra.equals("videocall")) {
                if (answer == JOptionPane.YES_OPTION) {

                    VideoLlamada();

                    ListaBitacoras.add(new Bitacora(FechaBitacora.toString(), "se hizo una videollamada", UsuarioIngresado.getUserName()));
                    InsertarBitacoraEnDB(FechaBitacora.toString(), "se hizo una videollamada", UsuarioIngresado.getUserName());
                    LlenarBitacora();

                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                } else {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            } else {
                if (answer == JOptionPane.YES_OPTION) {
                    TextFieldActual.setText(Palabra);
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                } else if (answer == JOptionPane.NO_OPTION) {
                    Palabra = "";
                    PalabraAnterior = "";
                    GPalabra.setGst("");
                }
            }
        }
    }

    public void ReconocedorSearch(JTextField TextFieldActual) {
        Palabra = TextFieldActual.getText();
        if (!"".equals(Palabra)) {
            int answer = JOptionPane.showConfirmDialog(jd_User, "¿Quieres buscar a " + Palabra + "?");

            for (int i = 0; i < ListaContactos.size(); i++) {
                if (ListaContactos.get(i).getName().equals(Palabra) && answer == JOptionPane.YES_OPTION) {
                    LlenarCamposContacts(ListaContactos.get(i));
                    
                    jl_Imagen_VoiceCall.setText("");
                    
                    File Archivo = new File(ListaContactos.get(i).getRutaImagen());
                    Image Img = Toolkit.getDefaultToolkit().createImage(Archivo.getPath()).getScaledInstance(180, 229, 0);
                    jl_Imagen_VoiceCall.setIcon(new ImageIcon(Img));
                    jl_Imagen_Contacts.setIcon(new ImageIcon(Img));
                }
            }

            Palabra = "";
            PalabraAnterior = "";
            GPalabra.setGst("");
        } else {
            Palabra = "";
            PalabraAnterior = "";
            GPalabra.setGst("");
        }
    }

    public void VideoLlamada() {
        Webcam webcam = Webcam.getDefault();

        WebcamPanel panel = new WebcamPanel(webcam);
        panel.setFPSDisplayed(true);

        JFrame window = new JFrame("VIDEO CALL");
        window.setTitle("Haciendo videollamada con " + jt_Name_Contacts.getText());

        window.setExtendedState(MAXIMIZED_BOTH);
        panel.setFillArea(true);

        window.add(panel);
        window.pack();
        window.setVisible(true);
    }

    public void LimpiarCamposLogIn() {
        jt_Username_LogIn.setText("USERNAME");
        jt_Password_LogIn.setText("PASSWORD");
    }

    public void LimpiarCamposCreateAccount() {
        jt_FirstName_CreateAccount.setText("First");
        jt_LastName_CreateAccount.setText("Last");
        jt_Username_CreateAccount.setText("");
        jt_Password_CreateAccount.setText("");
        jt_ConfirmPassword_CreateAccount.setText("");
        jt_Day_CreateAccount.setText("");
        jt_Year_CreateAccount.setText("");
        jt_PhoneNumber_CreateAccount.setText("");
    }

    public void LlenarCamposProfile() {
        jt_FirstName_Profile.setText(UsuarioIngresado.getFirstName());
        jt_LastName_Profile.setText(UsuarioIngresado.getLastName());
        jt_Username_Profile.setText(UsuarioIngresado.getUserName());
        jt_Password_Profile.setText(UsuarioIngresado.getContraseña());
        jt_ConfirmPassword_Profile.setText(UsuarioIngresado.getContraseña());
        jt_PhoneNumber_Profile.setText(UsuarioIngresado.getPhone());
    }

    public void LlenarCamposContacts(Contacto ContactoActual) {
        jt_Name_Contacts.setText(ContactoActual.getName());
        jt_PhoneticName_Contacts.setText(ContactoActual.getPhoneticName());
        jt_NickName_Contacts.setText(ContactoActual.getNickName());
        jt_Phone_Contacts.setText(ContactoActual.getPhone());
        jt_Day_Contacts.setText("");
        jt_Year_Contacts.setText("");
        jt_Email_Contacts.setText(ContactoActual.getEmail());
        jl_Imagen_Contacts.setText("");

        File Archivo = new File(ContactoActual.getRutaImagen());
        Image Img = Toolkit.getDefaultToolkit().createImage(Archivo.getPath()).getScaledInstance(180, 229, 0);
        jl_Imagen_Contacts.setIcon(new ImageIcon(Img));
    }

    public void LimpiarCamposProfile() {
        jt_FirstName_Profile.setText("First");
        jt_LastName_Profile.setText("Last");
        jt_Username_Profile.setText("");
        jt_Password_Profile.setText("");
        jt_ConfirmPassword_Profile.setText("");
        jt_Day_Profile.setText("DAY");
        jt_Year_Profile.setText("YEAR");
        jt_PhoneNumber_Profile.setText("");
    }

    public void LimpiarCamposContacts() {
        jt_Name_Contacts.setText("");
        jt_PhoneticName_Contacts.setText("");
        jt_NickName_Contacts.setText("");
        jt_Phone_Contacts.setText("");
        jt_Day_Contacts.setText("DAY");
        jt_Year_Contacts.setText("YEAR");
        jt_Email_Contacts.setText("");
        RutaImagen = "";
    }

    public void LimpiarMensaje() {
        jta_Subject_Inbox.setText("");
    }

    public void RecargarGramatica() {
        try {
            FileReader grammar1 = new FileReader("e:/Proyectos/LP_Proyecto/VoiceRecognizer/Gramatica.txt");
            RuleGrammar rg = recognizer.loadJSGF(grammar1);
            rg.setEnabled(true);

        } catch (Exception e) {
        }
    }
    //----------------------------------------------------------------------------------------------------------

    public void Recognizer() {
        try {
            recognizer = Central.createRecognizer(new EngineModeDesc(Locale.ROOT));
            recognizer.allocate();

            FileReader grammar1 = new FileReader("e:/Proyectos/LP_Proyecto/VoiceRecognizer/Gramatica.txt");

            RuleGrammar rg = recognizer.loadJSGF(grammar1);
            rg.setEnabled(true);

            System.out.println(GPalabra.getGst());
            recognizer.addResultListener(new Escucha(GPalabra));

            System.out.println("Empieze Dictado");
            recognizer.commitChanges();

            recognizer.requestFocus();
            recognizer.resume();
        } catch (Exception e) {
            System.out.println("Exception en " + e.toString());
            e.printStackTrace();
            System.exit(0);
        }
    }
    //---------------------------------------------------------------------------------

    public void ConectarDB() {
        try {
            String connectionUrl = "jdbc:sqlserver://;database=VoiceRecognizer;integratedSecurity=true;";
            Conect = DriverManager.getConnection(connectionUrl);
            System.out.println("Conectado.");
        } catch (SQLException ex) {
            System.out.println("Error.");
        }
    }
}