   package base_leslie;

   import java.sql.*;
   import java.lang.Object;
   import java.util.ArrayList;
   import java.util.Date;
   import java.lang.Integer;
   import javax.swing.table.TableCellEditor;
   import javax.swing.table.TableColumn;
   import java.awt.event.MouseEvent;
   import java.util.ArrayList;
   import java.lang.Integer;
   import java.awt.event.InvocationEvent;
   import java.awt.EventQueue;
   import java.awt.*;
   import javax.swing.JFrame;

 /*
 * @author  fconejer
 */
    public class JFrame_Leslie extends javax.swing.JFrame {
    
    /** Creates new form JFrame_Leslie */
    //Definicion de variables globales para trabajar.
    
    
       public JFrame_Leslie() throws  Exception{
      
         initComponents();
         initManejo_Datos();  
         mdbc = new MyDBConnection();//Genera un nuevo objeto para la conexion.
         if(mdbc.init()){
            Connection conn = mdbc.getMyConnection();
            stmt = conn.createStatement();
         }
         else{
               jMensaje.setLocation(0,0);
               jMensaje.setTitle("ATENCION.....");
               jLabel9.setText("En su computador, no está instalado el motor de DB necesario");
               jMensaje.setSize(400,65);
               jMensaje.setVisible(true);
         }
         
         userLista = new ArrayList();//Arreglo apra almacenar a los usuarios.
      	 userEjercicios = new ArrayList();//Arreglo para los ejercicios.
      	
         Date hoy = new Date(); 
        
         
         fecha = hoy.toString();
         fecha = fecha.substring(0,10);
         System.out.println(fecha);//Debuger. 
         jTextFecha.setText(fecha);
         TEMPORAL = new Ejercicio();
         
         TablasParametros();//Fija los tamaños de la tabla
           
      }
    
   
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jMensaje = new javax.swing.JDialog();
        jLabel9 = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        Principal_Tabla = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        JIngresar = new javax.swing.JButton();
        jIngreso_rut = new javax.swing.JTextField();
        jTextFecha = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jEstadisticas = new javax.swing.JTable();
        jEjercioLista = new javax.swing.JComboBox();
        jRut_Estadistica = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jNombre_Estadistica = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        jTest_Estadistica = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jRut_Ingresar = new javax.swing.JTextField();
        jNombre_Ingresar = new javax.swing.JTextField();
        jApdoPaterno_Ingresar = new javax.swing.JTextField();
        jApdoMaterno_Ingresar = new javax.swing.JTextField();
        jDireccion_Ingresar = new javax.swing.JTextField();
        jCiudad_Ingresar = new javax.swing.JTextField();
        jCarrera_Ingresar = new javax.swing.JTextField();
        jTelefono_Ingresar = new javax.swing.JTextField();
        jPeso_Ingresar = new javax.swing.JTextField();
        jTalla_Ingresar = new javax.swing.JTextField();
        jIMC_Ingresar = new javax.swing.JTextField();
        jTelefono = new javax.swing.JLabel();
        jDireccion = new javax.swing.JLabel();
        jRut = new javax.swing.JLabel();
        jApellidos = new javax.swing.JLabel();
        jNombres = new javax.swing.JLabel();
        jPeso = new javax.swing.JLabel();
        jFecha_Nacimiento = new javax.swing.JLabel();
        jMes_Ingresar = new javax.swing.JComboBox();
        jDia_Ingresar = new javax.swing.JComboBox();
        jAño_Ingresar = new javax.swing.JComboBox();
        jIngresar = new javax.swing.JButton();
        jApellidos1 = new javax.swing.JLabel();
        jPeso1 = new javax.swing.JLabel();
        jIMC = new javax.swing.JLabel();
        jTelefono1 = new javax.swing.JLabel();
        jTelefono2 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton3 = new javax.swing.JRadioButton();
        jTipoEntrenamiento = new javax.swing.JComboBox();
        jRut1 = new javax.swing.JLabel();
        jRut2 = new javax.swing.JLabel();
        jpasaTiempo = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jButton5 = new javax.swing.JButton();
        jTextField5 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jRut_editar = new javax.swing.JTextField();
        jApellido_Editar = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jNombre_Editar = new javax.swing.JTextField();
        jButton6 = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jTextField9 = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextField10 = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextField11 = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        Salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();

        jMensaje.setTitle("Error");
        jMensaje.setAlwaysOnTop(true);
        jMensaje.setBackground(new java.awt.Color(0, 150, 250));
        jMensaje.setForeground(java.awt.Color.white);
        jMensaje.setName("Hola....\"");
        jLabel9.setText("El usuario no est\u00e1 registrado");

        org.jdesktop.layout.GroupLayout jMensajeLayout = new org.jdesktop.layout.GroupLayout(jMensaje.getContentPane());
        jMensaje.getContentPane().setLayout(jMensajeLayout);
        jMensajeLayout.setHorizontalGroup(
            jMensajeLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jMensajeLayout.createSequentialGroup()
                .add(20, 20, 20)
                .add(jLabel9, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE))
        );
        jMensajeLayout.setVerticalGroup(
            jMensajeLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jMensajeLayout.createSequentialGroup()
                .add(jLabel9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 27, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(63, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("ADMINISTRADOR GYM.");
        setAlwaysOnTop(true);
        setResizable(false);
        jTabbedPane1.setBackground(new java.awt.Color(255, 200, 0));
        jTabbedPane1.setForeground(new java.awt.Color(120, 0, 0));
        jTabbedPane1.setMinimumSize(new java.awt.Dimension(99, 80));
        jTabbedPane1.setPreferredSize(new java.awt.Dimension(99, 80));
        jPanel1.setMaximumSize(new java.awt.Dimension(32767, 22767));
        jScrollPane1.setBackground(new java.awt.Color(200, 200, 128));
        Principal_Tabla.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Nº....", "Rut.", "USUARIO", "Ultima Seción", "Promedio Semanal", "Total Seciones x Mes"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        Principal_Tabla.setSelectionBackground(new java.awt.Color(240, 240, 240));
        jScrollPane1.setViewportView(Principal_Tabla);

        jButton1.setText("Prueba");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        JIngresar.setText("Ingresar");
        JIngresar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                JIngresarMouseClicked(evt);
            }
        });

        jIngreso_rut.setText("Ingrese el Rut....");
        jIngreso_rut.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jIngreso_rutMouseClicked(evt);
            }
        });

        jTextFecha.setEditable(false);
        jTextFecha.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jTextFecha.setText("fecha.....");
        jTextFecha.setToolTipText("hola");
        jTextFecha.setFocusTraversalPolicyProvider(true);

        jLabel20.setText("Fecha:");

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel20)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jTextFecha, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 436, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(24, 24, 24)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jIngreso_rut, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 176, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(21, 21, 21))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 116, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(JIngresar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 144, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(25, 25, 25)))
                .add(21, 21, 21))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(11, 11, 11)
                        .add(jIngreso_rut, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(14, 14, 14))
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(9, 9, 9)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel20, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(jTextFecha, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(26, 26, 26)))
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(JIngresar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(112, 112, 112)
                        .add(jButton1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 261, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(85, 85, 85))
        );
        jTabbedPane1.addTab("Principal", jPanel1);

        jEstadisticas.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "Fecha", "Carga", "Repeticiones", "Series", "Pausa"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, true, true
            };

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

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jEstadisticas.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jEstadisticasKeyPressed(evt);
            }
        });

        jScrollPane2.setViewportView(jEstadisticas);

        jEjercioLista.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " ", "PRES_BANCA", "Aperturas", "PECK_DECK", "Press c/Mancuernas", "Jalon Posterior", "Jalon Anterior", "Remo c/Mancuerna", "Dominadas", "Jalon Agarre Estrecho", "Remo de Pie" }));
        jEjercioLista.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jEjercioListaActionPerformed(evt);
            }
        });

        jRut_Estadistica.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jRut_EstadisticaKeyPressed(evt);
            }
        });
        jRut_Estadistica.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jRut_EstadisticaMouseClicked(evt);
            }
        });

        jLabel17.setText("RUT:");

        jLabel18.setText("Nombre:");

        jButton2.setText("Buscar");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });

        jLabel19.setText("Ultimo Test:");

        jLabel21.setText("Zona Muscular:");

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(38, 38, 38)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel18)
                    .add(jLabel17))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel3Layout.createSequentialGroup()
                        .add(jRut_Estadistica, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(33, 33, 33)
                        .add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jNombre_Estadistica, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 282, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 113, Short.MAX_VALUE)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel21)
                    .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                        .add(jEjercioLista, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jPanel3Layout.createSequentialGroup()
                            .add(jLabel19)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(jTest_Estadistica, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(27, Short.MAX_VALUE))
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 444, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(207, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel18)
                            .add(jNombre_Estadistica, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel3Layout.createSequentialGroup()
                        .add(24, 24, 24)
                        .add(jLabel21, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jRut_Estadistica, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jLabel17))
                    .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(jEjercioLista, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .add(11, 11, 11)
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel3Layout.createSequentialGroup()
                        .add(179, 179, 179)
                        .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jTest_Estadistica, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 28, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel19)))
                    .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 249, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(259, 259, 259))
        );
        jTabbedPane1.addTab("Estadisticas", jPanel3);

        jPanel4.setLayout(null);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ficha de datos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), null));
        jPanel4.add(jRut_Ingresar);
        jRut_Ingresar.setBounds(120, 30, 100, 20);

        jPanel4.add(jNombre_Ingresar);
        jNombre_Ingresar.setBounds(120, 60, 280, 20);

        jPanel4.add(jApdoPaterno_Ingresar);
        jApdoPaterno_Ingresar.setBounds(120, 90, 280, 20);

        jPanel4.add(jApdoMaterno_Ingresar);
        jApdoMaterno_Ingresar.setBounds(120, 120, 280, 20);

        jPanel4.add(jDireccion_Ingresar);
        jDireccion_Ingresar.setBounds(120, 150, 350, 20);

        jPanel4.add(jCiudad_Ingresar);
        jCiudad_Ingresar.setBounds(120, 180, 130, 20);

        jPanel4.add(jCarrera_Ingresar);
        jCarrera_Ingresar.setBounds(120, 210, 350, 20);

        jPanel4.add(jTelefono_Ingresar);
        jTelefono_Ingresar.setBounds(330, 180, 140, 20);

        jPeso_Ingresar.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jPanel4.add(jPeso_Ingresar);
        jPeso_Ingresar.setBounds(120, 240, 50, 20);

        jTalla_Ingresar.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jPanel4.add(jTalla_Ingresar);
        jTalla_Ingresar.setBounds(230, 240, 50, 20);

        jIMC_Ingresar.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        jPanel4.add(jIMC_Ingresar);
        jIMC_Ingresar.setBounds(340, 240, 50, 20);

        jTelefono.setText("Telefono:");
        jPanel4.add(jTelefono);
        jTelefono.setBounds(280, 180, 60, 14);

        jDireccion.setText("Direcci\u00f3n:");
        jPanel4.add(jDireccion);
        jDireccion.setBounds(60, 150, 70, 14);

        jRut.setText("RUT:");
        jPanel4.add(jRut);
        jRut.setBounds(90, 30, 50, 14);

        jApellidos.setText("Apellido Paterno:");
        jPanel4.add(jApellidos);
        jApellidos.setBounds(20, 90, 100, 14);

        jNombres.setText("Nombre:");
        jPanel4.add(jNombres);
        jNombres.setBounds(70, 60, 70, 14);
        jNombres.getAccessibleContext().setAccessibleName("Nombres:");

        jPeso.setText("Peso Inicial:");
        jPanel4.add(jPeso);
        jPeso.setBounds(50, 240, 70, 14);

        jFecha_Nacimiento.setText("Fecha Nacimiento:");
        jPanel4.add(jFecha_Nacimiento);
        jFecha_Nacimiento.setBounds(10, 270, 110, 14);

        jMes_Ingresar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" }));
        jPanel4.add(jMes_Ingresar);
        jMes_Ingresar.setBounds(210, 270, 110, 22);

        jDia_Ingresar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        jPanel4.add(jDia_Ingresar);
        jDia_Ingresar.setBounds(120, 270, 60, 22);

        jAño_Ingresar.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1960", "1961", "1962", "1963", "1964", "1965", "1966", "1967", "1968", "1969", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007" }));
        jPanel4.add(jAño_Ingresar);
        jAño_Ingresar.setBounds(350, 270, 90, 22);

        jIngresar.setText("Ingresar");
        jIngresar.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jIngresar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jIngresarMouseClicked(evt);
            }
        });

        jPanel4.add(jIngresar);
        jIngresar.setBounds(480, 50, 140, 50);

        jApellidos1.setText("Apellido Materno:");
        jPanel4.add(jApellidos1);
        jApellidos1.setBounds(20, 120, 110, 14);

        jPeso1.setText("Talla:");
        jPanel4.add(jPeso1);
        jPeso1.setBounds(200, 240, 40, 14);

        jIMC.setText("IMC:");
        jPanel4.add(jIMC);
        jIMC.setBounds(310, 240, 40, 14);

        jTelefono1.setText("Ciudad:");
        jPanel4.add(jTelefono1);
        jTelefono1.setBounds(70, 180, 60, 14);

        jTelefono2.setText("Carrera:");
        jPanel4.add(jTelefono2);
        jTelefono2.setBounds(70, 210, 60, 14);

        jRadioButton1.setText("Fuma.");
        jRadioButton1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButton1.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jPanel4.add(jRadioButton1);
        jRadioButton1.setBounds(510, 140, 80, 15);

        jRadioButton3.setText("Alcohol");
        jRadioButton3.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRadioButton3.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jPanel4.add(jRadioButton3);
        jRadioButton3.setBounds(510, 160, 70, 15);

        jTipoEntrenamiento.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Rutina General", "Rutina Dividida", "Rutina tipo Circuito", "Kin\u00e9sica", "Cardiovascular" }));
        jPanel4.add(jTipoEntrenamiento);
        jTipoEntrenamiento.setBounds(80, 340, 117, 22);

        jRut1.setText("Tipo de Entrenamiento:");
        jPanel4.add(jRut1);
        jRut1.setBounds(40, 320, 130, 14);

        jRut2.setText("Pasatiempos:");
        jPanel4.add(jRut2);
        jRut2.setBounds(230, 320, 80, 14);

        jpasaTiempo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Leer", "Ver Realyti", "Colecciones", "Deporte" }));
        jPanel4.add(jpasaTiempo);
        jpasaTiempo.setBounds(250, 340, 82, 22);

        jTabbedPane1.addTab("Datos Personales", jPanel4);

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ficha de datos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(0, 0, 204)));
        jButton5.setText("Editar");

        jLabel5.setText("Telefono:");

        jLabel4.setText("Direcci\u00f3n:");

        jLabel3.setText("RUT:");

        jLabel2.setText("Apellido:");

        jLabel1.setText("Nombre:");

        jButton6.setText("Eliminar");

        jLabel6.setText("Peso:");

        jTextField9.setHorizontalAlignment(javax.swing.JTextField.LEFT);

        jLabel7.setText("Edad:");

        jLabel8.setText("Fecha inicio:");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel1)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel2)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel3)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel4)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel5)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel6)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel7)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel8))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jNombre_Editar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
                    .add(jApellido_Editar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
                    .add(jTextField4)
                    .add(jRut_editar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
                    .add(jTextField5)
                    .add(jTextField9)
                    .add(jTextField10)
                    .add(jTextField11, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 71, Short.MAX_VALUE))
                .add(247, 247, 247))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(424, Short.MAX_VALUE)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(jButton5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 146, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                        .add(jButton6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 154, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(71, 71, 71))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel1)
                    .add(jNombre_Editar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel2)
                    .add(jApellido_Editar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(jRut_editar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jTextField4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel5)
                    .add(jTextField5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel6)
                    .add(jTextField9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel7)
                    .add(jTextField10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel8)
                    .add(jTextField11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(16, 16, 16)
                .add(jButton5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jButton6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(72, Short.MAX_VALUE))
        );
        jTabbedPane1.addTab("  Editar  ", jPanel2);

        jPanel5.setBackground(new java.awt.Color(230, 230, 200));
        org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 661, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 401, Short.MAX_VALUE)
        );
        jTabbedPane1.addTab("Variaci\u00f3n Fuerza", jPanel5);

        jMenu1.setText("Archivo");
        jMenuItem1.setText("Abrir..");
        jMenu1.add(jMenuItem1);

        jMenuItem2.setText("Guardar..");
        jMenu1.add(jMenuItem2);

        Salir.setText("Cerrar...");
        Salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                SalirActionPerformed(evt);
            }
        });

        jMenu1.add(Salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Propiedades");
        jMenuBar1.add(jMenu2);

        jMenu3.setText("Ayuda");
        jMenuBar1.add(jMenu3);

        jMenu4.setText("Menu");
        jMenuBar1.add(jMenu4);

        setJMenuBar(jMenuBar1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 666, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
                .addContainerGap())
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jEstadisticasKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jEstadisticasKeyPressed
         if(evt.getKeyCode() == evt.VK_ENTER ){
           System.out.println("UPDATE ejercicio SET carga = " + (Integer)jEstadisticas.getValueAt(0, 1) + 
                        ", repeticiones = " + (Integer)jEstadisticas.getValueAt(0, 2) + ", series = " +
                        (Integer)jEstadisticas.getValueAt(0 , 3) + " WHERE fecha = '" + fecha + "' and ejercicio_ID = '" +
                        (String)jEjercioLista.getSelectedItem() + "'"); 
           try {
                stmt.executeUpdate("UPDATE ejercicio SET carga = " + (Integer)jEstadisticas.getValueAt(0, 1) + 
                        ", repeticiones = " + (Integer)jEstadisticas.getValueAt(0, 2) + ", series = " +
                        (Integer)jEstadisticas.getValueAt(0 , 3) + " WHERE fecha = '" + fecha + "' and ejercicio_ID = '" +
                        (String)jEjercioLista.getSelectedItem() + "' and Rut_ID = '" + jRut_Estadistica.getText() + "'" ); 
            } catch (SQLException ex) {
                //ex.printStackTrace();
            }
             
            }
    

// TODO add your handling code here:
    }//GEN-LAST:event_jEstadisticasKeyPressed

    private void jRut_EstadisticaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jRut_EstadisticaKeyPressed
           
        if(evt.getKeyCode() == evt.VK_ENTER ){
        String Rut = null;
        ResultSet rs;
        
        Rut = jRut_Estadistica.getText();

        //Lleva todo los valores a cero, en la tabla de estadisticas.
        for(int i = 0; i < jEstadisticas.getRowCount(); i++ )
            for(int j = 0; j < jEstadisticas.getColumnCount(); j++)
            {
               jEstadisticas.setValueAt(null, i, j);
        }
        //***************************************************************************//
        
        try {
            rs = stmt.executeQuery("SELECT * FROM usuario WHERE Rut_ID = '" + Rut + "'");
            rs.next();
            
            jNombre_Estadistica.setText(rs.getString("nombre") + " " + rs.getString("ap_paterno")); 
            
        
        } catch (SQLException ex) {
            //ex.printStackTrace();
        }
        
    }




// TODO add your handling code here:
    }//GEN-LAST:event_jRut_EstadisticaKeyPressed

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

        String EjerItem = null;
        String rut = null;
        EjerItem = (String)jEjercioLista.getSelectedItem();//Toma el rut, y lo deja en el String.
        
        
        int x = 0;
        ResultSet rs = null;
        rut = jRut_Estadistica.getText();
        
        //Lleva todo los valores a cero, en la tabla de estadisticas.
        for(int i = 0; i < jEstadisticas.getRowCount(); i++ )
            for(int j = 0; j < jEstadisticas.getColumnCount(); j++)
            {
            jEstadisticas.setValueAt(null, i, j);
        }
        
        
        //CREA LA NUEVA ANOTACION EN LA BASE, CON EL EJERCICIO RESPECTIVO.
        
        if(!jRut_Estadistica.getText().equalsIgnoreCase("")){
                
        try {
            ResultSet rs2 = stmt.executeQuery("SELECT * FROM ejercicio WHERE fecha = '"+ fecha +"' and ejercicio_ID = '"+
                    (String)jEjercioLista.getSelectedItem()+"' and Rut_ID = '" + jRut_Estadistica.getText() + "'");
            if(!rs2.next()){
              stmt.executeUpdate("INSERT INTO ejercicio VALUES ('"+ fecha +"','"+ (String)jEjercioLista.getSelectedItem() + "','" + jRut_Estadistica.getText() + "', 0, 0, 0)");
            }
            
        } catch (SQLException ex) {
            //ex.printStackTrace();
        }
        }
        
        try {
             rs = stmt.executeQuery("SELECT * FROM ejercicio WHERE ejercicio_ID = '" + EjerItem + "' and Rut_ID = '"+
             jRut_Estadistica.getText() + "'");
             rs.last();
             x = rs.getRow() - 1;
             rs.beforeFirst();
             while(rs.next()){
                jEstadisticas.setValueAt(rs.getString("fecha"), x , 0);
                jEstadisticas.setValueAt(rs.getInt("carga"), x , 1);
                jEstadisticas.setValueAt(rs.getInt("repeticiones"), x , 2);
                jEstadisticas.setValueAt(rs.getInt("series"), x , 3);
                               
                x--;
                }
        }
         catch (SQLException ex) {
                //ex.printStackTrace();
        }        
       
        x=0; //Retoma el valor inicial de x.
        

// TODO add your handling code here:
    }//GEN-LAST:event_jEjercioListaActionPerformed

    private void jRut_EstadisticaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRut_EstadisticaMouseClicked
        jRut_Estadistica.setText("");
        jNombre_Estadistica.setText("");
        
    }//GEN-LAST:event_jRut_EstadisticaMouseClicked

    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked
        
        String Rut = null;
        ResultSet rs;
        
        Rut = jRut_Estadistica.getText();

        //Lleva todo los valores a cero, en la tabla de estadisticas.
        for(int i = 0; i < jEstadisticas.getRowCount(); i++ )
            for(int j = 0; j < jEstadisticas.getColumnCount(); j++)
            {
               jEstadisticas.setValueAt(null, i, j);
        }
        //***************************************************************************//
        
        try {
            rs = stmt.executeQuery("SELECT * FROM usuario WHERE Rut_ID = '" + Rut + "'");
            if(rs.next())
                jNombre_Estadistica.setText(rs.getString("nombre") + " " + rs.getString("ap_paterno")); 
        
        } catch (SQLException ex) {
            //ex.printStackTrace();
        }
        
        
    }//GEN-LAST:event_jButton2MouseClicked
        
       private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
        
         jMensaje.setLocation(100,100);
         jMensaje.setTitle("ATENCION.....");
         jMensaje.setSize(215,65);
         jMensaje.setVisible(true);
        
        
      // TODO add your handling code here:
      }//GEN-LAST:event_jButton1MouseClicked
    
       private void jIngresarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jIngresarMouseClicked
        
         Integer Temp = new Integer(0);
         Usuarios Nuevo = new Usuarios();

        if(!jRut_Ingresar.getText().equalsIgnoreCase("") && !jNombre_Ingresar.getText().equalsIgnoreCase("")){
        /*
        jApdoPaterno_Ingresar.setText("");
        jApdoMaterno_Ingresar.setText("");
        jDireccion_Ingresar.setText("");
        jTelefono_Ingresar.setText("");
        jDireccion_Ingresar.setText("");
        jCiudad_Ingresar.setText("");
        jCarrera_Ingresar.setText("");
        jTelefono_Ingresar.setText("");
        jPeso_Ingresar.setText("");
        jTalla_Ingresar.setText("");
        jIMC_Ingresar.setText("");) 
         */
        try {
            stmt.executeUpdate("INSERT INTO usuario VALUES ('"+ jRut_Ingresar.getText() + "','" + jNombre_Ingresar.getText() +
                    "','" + jApdoPaterno_Ingresar.getText() + "','" + jApdoMaterno_Ingresar.getText() + "','" +
                    jDireccion_Ingresar.getText() + "','" + jCiudad_Ingresar.getText() +"','" + jCarrera_Ingresar.getText() +
                    "'," + jTelefono_Ingresar.getText() + ",'" + 
                    (String)jDia_Ingresar.getSelectedItem() + "-" + (String)jMes_Ingresar.getSelectedItem() + "-" +
                    (String)jAño_Ingresar.getSelectedItem() + "')");
            
        } catch (SQLException ex) {
            //ex.printStackTrace();   
        }
        
      
        try {
            stmt.executeUpdate("INSERT INTO user_trabajo VALUES ('"+ jRut_Ingresar.getText() + "'," + jPeso_Ingresar.getText() +
                    "," + jTalla_Ingresar.getText() + "," + jIMC_Ingresar.getText() + ",'" 
                    + (String)jTipoEntrenamiento.getSelectedItem() + "')");
            
        } catch (SQLException ex) {
            //ex.printStackTrace();   
        }
        } 
        
        jRut_Ingresar.setText(""); jNombre_Ingresar.setText(""); 
        jApdoPaterno_Ingresar.setText(""); jApdoMaterno_Ingresar.setText("");
        jDireccion_Ingresar.setText(""); jTelefono_Ingresar.setText("");
        jDireccion_Ingresar.setText(""); jCiudad_Ingresar.setText("");
        jCarrera_Ingresar.setText(""); jTelefono_Ingresar.setText("");
        jPeso_Ingresar.setText(""); jTalla_Ingresar.setText("");
        jIMC_Ingresar.setText("");
         
        
        /*
         Nuevo.setID(jRut_Ingresar.getText());//Ingresa el ID-rut
         Nuevo.setNombre(jNombre_Ingresar.getText()); //Primer Nombre
         Nuevo.setApellido(1,jApdoPaterno_Ingresar.getText()); // Apellido Paterno
         Nuevo.setApellido(2,jApdoMaterno_Ingresar.getText()); // Apellido Materno
         Nuevo.setDireccion(jDireccion_Ingresar.getText()); // Direccion de usuario
         Nuevo.setFechanacimiento((String)jAño_Ingresar.getSelectedItem(), (String)jMes_Ingresar.getSelectedItem(), 
                                            (String)jDia_Ingresar.getSelectedItem());
         Nuevo.setFono(Temp.parseInt(jTelefono_Ingresar.getText()));
        
         Nuevo.printf1();
    */
      }//GEN-LAST:event_jIngresarMouseClicked
            
       private void JIngresarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JIngresarMouseClicked
        //Toma el rut ingresado   
        int N_columna;
        
        if(buscarUsuario()){
            N_columna = Principal_Tabla.getRowCount();//Me entrega el numero de filas, en el arreglo.
        
                if(!jIngreso_rut.getText().equalsIgnoreCase("")){
                    Usuarios user = new Usuarios();
                    user.setID(RUT2);
                    userLista.add(user);    
         
                
           try {
               //OBTENEMOS EL NOMBRE DEL USUARIO.
                ResultSet rs = stmt.executeQuery("SELECT * FROM usuario WHERE Rut_ID = '" + jIngreso_rut.getText() + "'");
                if(rs.next()){
                    temporal = rs.getString("nombre") + " " + rs.getString("ap_paterno");
                
                    Principal_Tabla.setValueAt(INDICE + 1, INDICE, 0);
                    Principal_Tabla.setValueAt(jIngreso_rut.getText() , INDICE, 1);
                    Principal_Tabla.setValueAt(temporal, INDICE, 2);
                    INDICE++;
                }
                    else{
                        jMensaje.setLocation(100,150);
                        jMensaje.setTitle("ATENCION.....");
                        jMensaje.setSize(215,65);
                        jMensaje.setVisible(true);
                    }
            
            }catch (SQLException ex) {
                     System.out.println("hola");
                    //ex.printStackTrace();
            }
       
            jIngreso_rut.setText("");
            System.out.println(temporal);
           }
         }
        
      // TODO add your handling code here:
      }//GEN-LAST:event_JIngresarMouseClicked
    
       private void jIngreso_rutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jIngreso_rutMouseClicked
         jIngreso_rut.setText("");
        
        // TODO add your handling code here:
      }//GEN-LAST:event_jIngreso_rutMouseClicked
            
       private void SalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SalirActionPerformed
        // TODO add your handling code here:
         mdbc.close(stmt);
         mdbc.destroy();
         System.exit(0);
      // TODO add your handling code here:
      }//GEN-LAST:event_SalirActionPerformed
    /*
       public static void main(String args[]) {
         java.awt.EventQueue.invokeLater(
                new Runnable() {
                   public void run() {
                     try{
                        new JFrame_Leslie().setVisible(true);
                     }
                         catch(Exception e){
                        }
                  }
               });
      }
    */
       private ResultSet getResultFormCars() {
        
         ResultSet rs = null;
        
         try{
            rs = stmt.executeQuery("Select * from Table");
         
         }
             catch(SQLException e){}
        
         return rs;
      }
     
    
       public String quotate(String content){
      
         return "'"+content+"'";
      }
  
       
       private void initManejo_Datos(){
        
         Principal_Tabla.addMouseListener(
                new java.awt.event.MouseAdapter() {
               
               //mouse click.
                   public void mouseClicked(MouseEvent e) {
                     int cell_X = 0;
                     int cell_Y = 0; 
                     cell_X = Principal_Tabla.columnAtPoint( e.getPoint());
                     cell_Y = Principal_Tabla.rowAtPoint( e.getPoint() );
                     
                     if(cell_X == 1){
                     temporal = (String)Principal_Tabla.getValueAt(cell_Y, cell_X + 1);    
                     jNombre_Estadistica.setText(temporal);
                     jRut_Estadistica.setText((String)Principal_Tabla.getValueAt(cell_Y, cell_X));
                     }       
                     //jEstadisticas.setValueAt(0, cell_X , cell_Y);
                  
                  }});
        
      }
       
      private void TablasParametros(){
        
         Principal_Tabla.getTableHeader().setReorderingAllowed(false);
         TableColumn columna = null;
        
        //Columna numeración.
         columna = Principal_Tabla.getColumnModel().getColumn(0);
         columna.setPreferredWidth(15);
         columna.setResizable(false);
        //Columna Rut
         columna = Principal_Tabla.getColumnModel().getColumn(1);
         columna.setPreferredWidth(70);
         columna.setResizable(false);
        //Columna Ultima Seción.
         columna = Principal_Tabla.getColumnModel().getColumn(2);
         columna.setPreferredWidth(150);
         columna.setResizable(false);
        //Columna Promedio Semanal
         columna = Principal_Tabla.getColumnModel().getColumn(3);
         columna.setPreferredWidth(50);
         columna.setResizable(false);
        //Columna Total Seciones.
         columna = Principal_Tabla.getColumnModel().getColumn(4);
         columna.setPreferredWidth(50);
         columna.setResizable(false);
      }
      
      private boolean buscarUsuario(){
          boolean usuario = true;
          String ID_ingresado = null;
          
          
          for(int x = 0; x < Principal_Tabla.getRowCount(); x++){
             ID_ingresado = (String)Principal_Tabla.getValueAt(x , 1);
              if(ID_ingresado != null && ID_ingresado.equals(jIngreso_rut.getText())){
                usuario = false;
                break;
                }
       
          }
          return(usuario);
      }
        
      private String fecha;
      private MyDBConnection mdbc;
      private java.sql.Statement stmt;
      private String NOMBRE, APELLIDO, RUT, RUT2;
      private ArrayList userLista;
      private ArrayList userEjercicios;
      private String temporal = null;
      private int INDICE;
      private Ejercicio TEMPORAL;
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton JIngresar;
    private javax.swing.JTable Principal_Tabla;
    private javax.swing.JMenuItem Salir;
    private javax.swing.JTextField jApdoMaterno_Ingresar;
    private javax.swing.JTextField jApdoPaterno_Ingresar;
    private javax.swing.JTextField jApellido_Editar;
    private javax.swing.JLabel jApellidos;
    private javax.swing.JLabel jApellidos1;
    private javax.swing.JComboBox jAño_Ingresar;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JTextField jCarrera_Ingresar;
    private javax.swing.JTextField jCiudad_Ingresar;
    private javax.swing.JComboBox jDia_Ingresar;
    private javax.swing.JLabel jDireccion;
    private javax.swing.JTextField jDireccion_Ingresar;
    private javax.swing.JComboBox jEjercioLista;
    private javax.swing.JTable jEstadisticas;
    private javax.swing.JLabel jFecha_Nacimiento;
    private javax.swing.JLabel jIMC;
    private javax.swing.JTextField jIMC_Ingresar;
    private javax.swing.JButton jIngresar;
    private javax.swing.JTextField jIngreso_rut;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    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.JDialog jMensaje;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JComboBox jMes_Ingresar;
    private javax.swing.JTextField jNombre_Editar;
    private javax.swing.JTextField jNombre_Estadistica;
    private javax.swing.JTextField jNombre_Ingresar;
    private javax.swing.JLabel jNombres;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JLabel jPeso;
    private javax.swing.JLabel jPeso1;
    private javax.swing.JTextField jPeso_Ingresar;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JLabel jRut;
    private javax.swing.JLabel jRut1;
    private javax.swing.JLabel jRut2;
    private javax.swing.JTextField jRut_Estadistica;
    private javax.swing.JTextField jRut_Ingresar;
    private javax.swing.JTextField jRut_editar;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jTalla_Ingresar;
    private javax.swing.JLabel jTelefono;
    private javax.swing.JLabel jTelefono1;
    private javax.swing.JLabel jTelefono2;
    private javax.swing.JTextField jTelefono_Ingresar;
    private javax.swing.JTextField jTest_Estadistica;
    private javax.swing.JTextField jTextFecha;
    private javax.swing.JTextField jTextField10;
    private javax.swing.JTextField jTextField11;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField9;
    private javax.swing.JComboBox jTipoEntrenamiento;
    private javax.swing.JComboBox jpasaTiempo;
    // End of variables declaration//GEN-END:variables
    
   }
