/*
 * 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 arql2020;


import static arql2020.ARQL2020.sumadora_llevar_peso;
import java.beans.PropertyVetoException;
import java.util.logging.Level;
import java.util.logging.Logger;
import static arql2020.ARQL2020.indexMP;
import clases.bagolini_tamaños;
import clases.conexion;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import static arql2020.ARQL2020.sumadora_llevar_peso;
import clases.Cargar_MP;
import static arql2020.ARQL2020.indexMP;
import clases.Limpiar_campos;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
import static arql2020.Internal_DT_sintalon.st4_peso;
import clases.ValidarCampos;



import static arql2020.ARQL2020.capa_nivel;
import static arql2020.ARQL2020.cuadro;
import static arql2020.ARQL2020.episodio_estruct_planta;
import static arql2020.ARQL2020.estruct_arq;

import static arql2020.ARQL2020.localidad;
import static arql2020.ARQL2020.microsector;
import static arql2020.ARQL2020.nombre_estruct_planta;
import static arql2020.ARQL2020.piso_subcapa;
import static arql2020.ARQL2020.siglasitio;
import static arql2020.ARQL2020.sitio;
import static arql2020.ARQL2020.tipo_estruct_planta;
import static arql2020.ARQL2020.zona_ambiental;
import static arql2020.DT_frame.arbol_DT;
import static arql2020.DT_frame.selectednodeparaeliminar;
import static arql2020.Internal_DT_sintalon.btn_eliminarregistro_Dt_sintalon;
import clases.InteraccionesBD;





public class Internal_DT_contalon extends javax.swing.JInternalFrame {

    
int num = 0;
    public Internal_DT_contalon() {
        initComponents();
                try {
            this.setMaximum(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(DT_frame.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * 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() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        INGRESAR = new javax.swing.JButton();
        ct4_cbx_entero_fracturado = new javax.swing.JComboBox<>();
        ct3_cbx_mp = new javax.swing.JComboBox<>();
        jPanel4 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        ct0_txt_codigo = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        ct1_txt_lote = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        ct2_txt_pieza = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        ct13_txt_anchotalon = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        ct11_txt_espesortalon = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        ct9_txt_espesormaximo = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        ct7_cbx_ancho = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        ct5_txt_largo = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        ct17_txt_tamaño = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        ct18_txt_modulo_long_ancho = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        ct19_txt_modulo_ancho_espesor = new javax.swing.JTextField();
        jButton4 = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        ct16_txt_peso = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jButton6 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jLabel25 = new javax.swing.JLabel();
        ct15_cbx_rangoanchotalon = new javax.swing.JComboBox<>();
        ct6_chk_largofracturado = new javax.swing.JCheckBox();
        ct8_chk_anchofracturado = new javax.swing.JCheckBox();
        ct10_chk_espesormaximofracturado = new javax.swing.JCheckBox();
        ct12_chk_espesortalonfracturado = new javax.swing.JCheckBox();
        ct14_chk_anchotalonfracturado = new javax.swing.JCheckBox();
        jButton8 = new javax.swing.JButton();
        jLabel10 = new javax.swing.JLabel();
        ct20_cbx_forma_sup_talon = new javax.swing.JComboBox<>();
        jLabel12 = new javax.swing.JLabel();
        ct21_txt_n_facetas_lascado = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        ct22_cbx_intervalo_facetas_lascado = new javax.swing.JComboBox<>();
        jLabel13 = new javax.swing.JLabel();
        ct23_cbx_forma_base = new javax.swing.JComboBox<>();
        lbl12 = new javax.swing.JLabel();
        ct24_cbx_origen_extraccion = new javax.swing.JComboBox<>();
        jLabel24 = new javax.swing.JLabel();
        INGRESAR1 = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel47 = new javax.swing.JLabel();
        ct25_cbx_corteza_caradorsal = new javax.swing.JComboBox<>();
        jLabel26 = new javax.swing.JLabel();
        ct26_cbx_corteza_talon = new javax.swing.JComboBox<>();
        jLabel48 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        ct27_txt_observaciones = new javax.swing.JTextArea();
        jButton1 = new javax.swing.JButton();
        btn_eliminarregistro_Dt_contalon = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();

        setResizable(true);
        setTitle("Desechos de talla con talón");
        addInternalFrameListener(new javax.swing.event.InternalFrameListener() {
            public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) {
            }
            public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) {
                formInternalFrameOpened(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(254, 215, 186));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 16)); // NOI18N
        jLabel1.setText("DT enteros y fracturados con talón");

        INGRESAR.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        INGRESAR.setText("Guardar");
        INGRESAR.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                INGRESARActionPerformed(evt);
            }
        });

        ct4_cbx_entero_fracturado.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct4_cbx_entero_fracturado.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "1.Entero", "2.Fracturado c/ talón", "CN" }));

        ct3_cbx_mp.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct3_cbx_mp.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione" }));
        ct3_cbx_mp.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ct3_cbx_mpItemStateChanged(evt);
            }
        });

        jPanel4.setBackground(new java.awt.Color(254, 231, 214));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Códigos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel15.setText("Código DT con talón");

        ct0_txt_codigo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct0_txt_codigo.setEnabled(false);

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

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

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

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

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(80, 80, 80)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel4Layout.createSequentialGroup()
                            .addComponent(jLabel3)
                            .addGap(20, 20, 20)
                            .addComponent(ct2_txt_pieza, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel4Layout.createSequentialGroup()
                            .addComponent(jLabel2)
                            .addGap(23, 23, 23)
                            .addComponent(ct1_txt_lote, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addGap(23, 23, 23)
                        .addComponent(ct0_txt_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(63, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel15)
                    .addComponent(ct0_txt_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel2)
                    .addComponent(ct1_txt_lote, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel3)
                    .addComponent(ct2_txt_pieza, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(20, Short.MAX_VALUE))
        );

        jPanel3.setBackground(new java.awt.Color(254, 231, 214));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Dimensionales", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        ct13_txt_anchotalon.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct13_txt_anchotalon.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct13_txt_anchotalonKeyTyped(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel9.setText("Ancho talón (cm)");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel8.setText("Espesor talón (cm)");

        ct11_txt_espesortalon.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct11_txt_espesortalon.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct11_txt_espesortalonKeyTyped(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel7.setText("Espesor máximo (cm)");

        ct9_txt_espesormaximo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct9_txt_espesormaximo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct9_txt_espesormaximoKeyTyped(evt);
            }
        });

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

        ct7_cbx_ancho.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct7_cbx_ancho.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct7_cbx_anchoKeyTyped(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Largo (cm)");

        ct5_txt_largo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct5_txt_largo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct5_txt_largoKeyTyped(evt);
            }
        });

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel16.setText("Tamaño*");

        ct17_txt_tamaño.setBackground(new java.awt.Color(255, 153, 153));
        ct17_txt_tamaño.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        ct17_txt_tamaño.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct17_txt_tamañoKeyTyped(evt);
            }
        });

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel17.setText("Módulo Long/Ancho*");

        ct18_txt_modulo_long_ancho.setBackground(new java.awt.Color(255, 153, 153));
        ct18_txt_modulo_long_ancho.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        ct18_txt_modulo_long_ancho.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct18_txt_modulo_long_anchoKeyTyped(evt);
            }
        });

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel18.setText("Módulo Ancho/Espesor*");

        ct19_txt_modulo_ancho_espesor.setBackground(new java.awt.Color(255, 153, 153));
        ct19_txt_modulo_ancho_espesor.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        ct19_txt_modulo_ancho_espesor.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct19_txt_modulo_ancho_espesorKeyTyped(evt);
            }
        });

        jButton4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton4.setText("Calcular");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

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

        ct16_txt_peso.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct16_txt_peso.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct16_txt_pesoKeyTyped(evt);
            }
        });

        jLabel20.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel20.setText("(gramos)");

        jLabel21.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel21.setText("*1");

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

        jLabel23.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel23.setText("*3");

        jButton6.setText("*Info");
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jButton7.setBackground(new java.awt.Color(255, 102, 102));
        jButton7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton7.setText("Sumadora de pesos");
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel25.setText("Rango ancho talón*");

        ct15_cbx_rangoanchotalon.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct15_cbx_rangoanchotalon.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "1- (<2mm)", "2- (2-7mm)", "3- (>7mm)", "CN" }));

        ct6_chk_largofracturado.setBackground(new java.awt.Color(254, 231, 214));
        ct6_chk_largofracturado.setText("Fracturado");
        ct6_chk_largofracturado.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ct6_chk_largofracturadoItemStateChanged(evt);
            }
        });

        ct8_chk_anchofracturado.setBackground(new java.awt.Color(254, 231, 214));
        ct8_chk_anchofracturado.setText("Fracturado");
        ct8_chk_anchofracturado.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ct8_chk_anchofracturadoItemStateChanged(evt);
            }
        });

        ct10_chk_espesormaximofracturado.setBackground(new java.awt.Color(254, 231, 214));
        ct10_chk_espesormaximofracturado.setText("Fracturado");
        ct10_chk_espesormaximofracturado.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ct10_chk_espesormaximofracturadoItemStateChanged(evt);
            }
        });

        ct12_chk_espesortalonfracturado.setBackground(new java.awt.Color(254, 231, 214));
        ct12_chk_espesortalonfracturado.setText("Fracturado");
        ct12_chk_espesortalonfracturado.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ct12_chk_espesortalonfracturadoItemStateChanged(evt);
            }
        });

        ct14_chk_anchotalonfracturado.setBackground(new java.awt.Color(254, 231, 214));
        ct14_chk_anchotalonfracturado.setText("Fracturado");
        ct14_chk_anchotalonfracturado.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ct14_chk_anchotalonfracturadoItemStateChanged(evt);
            }
        });

        jButton8.setText("Ver gráfico");
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(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()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(85, 85, 85)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel5)
                                .addComponent(jLabel6)
                                .addComponent(jLabel7)
                                .addComponent(jLabel8)
                                .addComponent(jLabel9))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel19)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(ct16_txt_peso)
                            .addComponent(ct11_txt_espesortalon, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 87, Short.MAX_VALUE)
                            .addComponent(ct9_txt_espesormaximo, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ct7_cbx_ancho, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ct5_txt_largo, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ct13_txt_anchotalon))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
                                    .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(ct14_chk_anchotalonfracturado)
                                    .addComponent(ct12_chk_espesortalonfracturado)
                                    .addComponent(ct10_chk_espesormaximofracturado)
                                    .addComponent(ct8_chk_anchofracturado)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(ct6_chk_largofracturado)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
                                        .addComponent(jButton6))))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(17, 17, 17)
                                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(72, 72, 72)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel17, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ct19_txt_modulo_ancho_espesor, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ct18_txt_modulo_long_ancho, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ct17_txt_tamaño, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton8)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(jLabel25)
                .addGap(10, 10, 10)
                .addComponent(ct15_cbx_rangoanchotalon, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(69, 69, 69))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(ct5_txt_largo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel21)
                            .addComponent(ct6_chk_largofracturado)))
                    .addComponent(jButton6))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel6)
                    .addComponent(ct7_cbx_ancho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22)
                    .addComponent(ct8_chk_anchofracturado))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel7)
                    .addComponent(ct9_txt_espesormaximo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23)
                    .addComponent(ct10_chk_espesormaximofracturado))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel8)
                    .addComponent(ct11_txt_espesortalon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ct12_chk_espesortalonfracturado))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel9)
                    .addComponent(ct13_txt_anchotalon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ct14_chk_anchotalonfracturado))
                .addGap(24, 24, 24)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ct16_txt_peso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19)
                    .addComponent(jLabel20)
                    .addComponent(jButton7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(ct17_txt_tamaño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17)
                            .addComponent(ct18_txt_modulo_long_ancho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel18)
                            .addComponent(ct19_txt_modulo_ancho_espesor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel25)
                    .addComponent(ct15_cbx_rangoanchotalon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(14, 14, 14))
        );

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel10.setText("Forma superficie talón*");

        ct20_cbx_forma_sup_talon.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct20_cbx_forma_sup_talon.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "Ct-Cortical", "Lic-Liso cortical", "Li-Liso", "Fc-Facetado", "Di-Diedro", "Fi-Filiforme", "Pt-Puntiforme", "Fr-Fracturado", "Rb-Rebajado", "Z-No pertinente", "CN" }));

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel12.setText("N° facetas de lascado");

        ct21_txt_n_facetas_lascado.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct21_txt_n_facetas_lascado.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct21_txt_n_facetas_lascadoKeyTyped(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel11.setText("Intervalo de facetas de lascado");

        ct22_cbx_intervalo_facetas_lascado.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct22_cbx_intervalo_facetas_lascado.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "1-Menos de 3", "2-Entre 3 y 5", "3-Más de 5", "CN" }));

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel13.setText("Forma base de lasca/hoja*");

        ct23_cbx_forma_base.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct23_cbx_forma_base.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "LsNd-Lasc.nodular", "LsP-Lasca primaria o cortical", "LsS-Lasca secundaria o de descortezamiento", "LsDN-Lasca con dorso natural(gajo)", "LsAng-Lasca angular", "LsAr-Lasca de arista", "LsPl-Lasca plana", "LsCta-Lasca en cresta", "LsFNu-Lasca de flanco de núcleo", "LsTNu-Lasca de tableta de núcleo", "LsST-Lasca de semitableta de núcleo", "LsBp.Lasca bipolar (doble bulbo de percusión)", "LsND-Lasca no diferenciada", " ", "HoArS-Hoja de arista simple", "HoArM-Hoja de arista doble o múltiple", "HoND-Hoja no diferenciada", " ", "FBND.Forma base no diferenciada  ", "CN" }));
        ct23_cbx_forma_base.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ct23_cbx_forma_baseItemStateChanged(evt);
            }
        });

        lbl12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        lbl12.setText("Origen de la extracción*");

        ct24_cbx_origen_extraccion.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct24_cbx_origen_extraccion.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "1-Adelg/Reduc bifacial", "2-React. Direc. Filos", "3-React Invers. Filos", "4-React plataf.", "5-Reac frent extrac", "6-Ls. Externa", "7-Ls Interna", "8-Hoja", "CN" }));

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel24.setText("¿Entero o fracturado?");

        INGRESAR1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        INGRESAR1.setText("Limpiar campos");
        INGRESAR1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                INGRESAR1ActionPerformed(evt);
            }
        });

        jPanel2.setBackground(new java.awt.Color(254, 231, 214));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Reserva de corteza", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        jLabel47.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel47.setText("Proporción en cara dorsal*");

        ct25_cbx_corteza_caradorsal.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct25_cbx_corteza_caradorsal.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "A-0%", "B-0.1-25%", "C-25.1-50%", "D-50.1-75%", "E-75.1-99%", "F-100%", "CN" }));

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel26.setText("En el talón");

        ct26_cbx_corteza_talon.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        ct26_cbx_corteza_talon.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "1-Sí", "0-No", "CN" }));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel47)
                    .addComponent(jLabel26))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ct25_cbx_corteza_caradorsal, 0, 366, Short.MAX_VALUE)
                    .addComponent(ct26_cbx_corteza_talon, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ct25_cbx_corteza_caradorsal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel47))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(ct26_cbx_corteza_talon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(32, Short.MAX_VALUE))
        );

        jLabel48.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel48.setText("Observaciones (500 caracteres)");

        ct27_txt_observaciones.setColumns(20);
        ct27_txt_observaciones.setFont(new java.awt.Font("Monospaced", 0, 16)); // NOI18N
        ct27_txt_observaciones.setLineWrap(true);
        ct27_txt_observaciones.setRows(5);
        ct27_txt_observaciones.setWrapStyleWord(true);
        ct27_txt_observaciones.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                ct27_txt_observacionesKeyPressed(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                ct27_txt_observacionesKeyTyped(evt);
            }
        });
        jScrollPane2.setViewportView(ct27_txt_observaciones);

        jButton1.setText("+");

        btn_eliminarregistro_Dt_contalon.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        btn_eliminarregistro_Dt_contalon.setText("Eliminar registro");
        btn_eliminarregistro_Dt_contalon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_eliminarregistro_Dt_contalonActionPerformed(evt);
            }
        });

        jLabel27.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel27.setText("Materia prima*");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(194, 194, 194)
                            .addComponent(jLabel24)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(ct4_cbx_entero_fracturado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(98, 98, 98)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addComponent(ct3_cbx_mp, javax.swing.GroupLayout.PREFERRED_SIZE, 577, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jButton1))
                                .addComponent(jLabel27))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(296, 296, 296)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 282, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(101, 101, 101)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(INGRESAR1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(46, 46, 46)
                                .addComponent(btn_eliminarregistro_Dt_contalon)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(INGRESAR, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 564, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel48)
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGap(162, 162, 162)
                                    .addComponent(jLabel10))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGap(170, 170, 170)
                                    .addComponent(jLabel12)))
                            .addGap(8, 8, 8)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(ct21_txt_n_facetas_lascado, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(ct20_cbx_forma_sup_talon, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 335, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                            .addGap(113, 113, 113)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel13, javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(lbl12, javax.swing.GroupLayout.Alignment.TRAILING))
                                    .addGap(8, 8, 8)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(ct23_cbx_forma_base, javax.swing.GroupLayout.Alignment.LEADING, 0, 335, Short.MAX_VALUE)
                                        .addComponent(ct24_cbx_origen_extraccion, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                                    .addComponent(jLabel11)
                                    .addGap(8, 8, 8)
                                    .addComponent(ct22_cbx_intervalo_facetas_lascado, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                .addContainerGap(211, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(5, 5, 5)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jLabel27)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jButton1)
                    .addComponent(ct3_cbx_mp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ct4_cbx_entero_fracturado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24))
                .addGap(32, 32, 32)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(17, 17, 17)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel13)
                    .addComponent(ct23_cbx_forma_base, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel12)
                    .addComponent(ct21_txt_n_facetas_lascado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel11)
                    .addComponent(ct22_cbx_intervalo_facetas_lascado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(21, 21, 21)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(lbl12)
                    .addComponent(ct24_cbx_origen_extraccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel10)
                    .addComponent(ct20_cbx_forma_sup_talon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabel48)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)
                .addGap(30, 30, 30)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(INGRESAR)
                    .addComponent(INGRESAR1)
                    .addComponent(btn_eliminarregistro_Dt_contalon))
                .addGap(23, 23, 23))
        );

        jScrollPane1.setViewportView(jPanel1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 866, Short.MAX_VALUE)
                .addGap(0, 0, 0))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1)
                .addGap(0, 0, 0))
        );

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

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

validarcampos();



if(selectednodeparaeliminar==null){
 
    guardarregistro();

}else{
    actualizarregistro();
}






    }//GEN-LAST:event_INGRESARActionPerformed
public void actualizarregistro(){
    int respuesta = 0;
    try {
     conexion c = new conexion();
    c.getConexion();

    respuesta = c.eliminar_actualizar("UPDATE DT_CONTALON2 SET "
            + ""
//            
            
            + "ZONA_AMBIENTAL='"+zona_ambiental+"', "
            + "LOCALIDAD='"+localidad+"', "
            + "SITIO='"+sitio+"', "
            + "SIGLA_SITIO='"+siglasitio+"', "
            + "CAPA_NIVEL='"+capa_nivel+"', "
            + "ESTRUC_ARQ='"+estruct_arq+"', "
            + "PISO_SUBCAPA='"+piso_subcapa+"', "
            + "ESTRUC_PLANTA='"+tipo_estruct_planta+"', "
            + "NOMBRE_ESTRUC_PLANTA='"+nombre_estruct_planta+"', "
            + "EPISODIO_ESTRUC_PLANTA='"+episodio_estruct_planta+"', "
            + "CUADRO='"+cuadro+"', "
            + "MICROSECTOR='"+microsector+"', "
            + "LOTE='"+ct1_txt_lote.getText()+"', "
            + "PIEZA='"+ct2_txt_pieza.getText()+"', "
            + "MP='"+ct3_cbx_mp.getSelectedItem()+"', "
            + "ENTERO_FRACTURADO='"+ct4_cbx_entero_fracturado.getSelectedItem()+"', "
            + "LARGO='"+ct5_txt_largo.getText()+"', "
            + "ANCHO='"+ct7_cbx_ancho.getText()+"', "
            + "ESPESOR_MAX='"+ct9_txt_espesormaximo.getText()+"', "
            + "ESPESOR_TALON='"+ct11_txt_espesortalon.getText()+"', "
            + "ANCHO_TALON='"+ct13_txt_anchotalon.getText()+"', "
            + "RANGO_ANCHO_TALON='"+ct15_cbx_rangoanchotalon.getSelectedItem()+"', "
            + "PESO='"+ct16_txt_peso.getText()+"', "
            + "TAMAÑO='"+ct17_txt_tamaño.getText()+"', "
            + "MODULO_LONG_ANCHO='"+ct18_txt_modulo_long_ancho.getText()+"', "
            + "MODULO_ANCHO_ESPESOR='"+ct19_txt_modulo_ancho_espesor.getText()+"', "
            + "FORMA_SUP_TALON='"+ct20_cbx_forma_sup_talon.getSelectedItem()+"', "
            + "N_FACETAS_LASCADO='"+ct21_txt_n_facetas_lascado.getText()+"', "
            + "N_INTERVALO_FACETAS_LASCADO='"+ct22_cbx_intervalo_facetas_lascado.getSelectedItem()+"', "
            + "FORMA_BASE='"+ct23_cbx_forma_base.getSelectedItem()+"', "
            + "ORIGEN_EXTRACCION='"+ct24_cbx_origen_extraccion.getSelectedItem()+"', "
            + "CORTEZA_CARA_DORSAL='"+ct25_cbx_corteza_caradorsal.getSelectedItem()+"', "
            + "CORTEZA_TALON='"+ct26_cbx_corteza_talon.getSelectedItem()+"', "
            + "OBSERVACIONES='"+ct27_txt_observaciones.getText()+"' "



            


         +" WHERE ID_DT_CONTALON="+Integer.parseInt(ct0_txt_codigo.getText()));
    

    c.closeconnection();



    
    } catch (NumberFormatException | SQLException e) {
    JOptionPane.showMessageDialog(null, "No se pudieron guardar las modificaciones en la pieza: " + e);
        }
    
            if(respuesta>0){
                    JOptionPane.showMessageDialog(null, "Se han actualizado los datos de la pieza: "+ ct2_txt_pieza.getText());
    
                    InteraccionesBD interac = new InteraccionesBD();
                    interac.actualizarhoja(arbol_DT, selectednodeparaeliminar, "CT", ct0_txt_codigo.getText(),ct2_txt_pieza.getText());
       
       
                    limpiarcampos();
                    consultarid();
                    btn_eliminarregistro_Dt_contalon.setEnabled(false);
        }
  
}
    public void guardarregistro (){
        

        try {
            conexion c = new conexion();
            c.getConexion();
            int aux = c.insert("insert into DT_CONTALON2(ID_DT_CONTALON, ZONA_AMBIENTAL,"
                + "LOCALIDAD,"
                + "SITIO,"
                + "SIGLA_SITIO,"
                + "CAPA_NIVEL,"
                + "ESTRUC_ARQ,"
                + "PISO_SUBCAPA,"
                + "ESTRUC_PLANTA,"
                + "NOMBRE_ESTRUC_PLANTA,"
                + "EPISODIO_ESTRUC_PLANTA,"
                + "CUADRO,"
                + "MICROSECTOR,"
                    
                + "LOTE,"
                + "PIEZA,"
                + "MP,"
                + "ENTERO_FRACTURADO,"
                + "LARGO,"
                + "ANCHO,"
                + "ESPESOR_MAX,"
                + "ESPESOR_TALON,"
                + "ANCHO_TALON,"
                + "RANGO_ANCHO_TALON,"
                + "PESO,"
                + "TAMAÑO,"
                + "MODULO_LONG_ANCHO,"
                + "MODULO_ANCHO_ESPESOR,"
                + "FORMA_SUP_TALON,"
                + "N_FACETAS_LASCADO,"
                + "N_INTERVALO_FACETAS_LASCADO,"
                + "FORMA_BASE,"
                + "ORIGEN_EXTRACCION,"
                + "CORTEZA_CARA_DORSAL,"
                + "CORTEZA_TALON,"
                + "OBSERVACIONES"
                +") Values ("+Integer.parseInt(ct0_txt_codigo.getText())+","
                +"'"+zona_ambiental+"',"
                +"'"+localidad+"',"
                +"'"+sitio+"',"
                +"'"+siglasitio+"',"
                +"'"+capa_nivel+"',"
                +"'"+estruct_arq+"',"
                +"'"+piso_subcapa+"',"
                +"'"+tipo_estruct_planta+"',"
                +"'"+nombre_estruct_planta+"',"
                +"'"+episodio_estruct_planta+"',"
                +"'"+cuadro+"',"
                +"'"+microsector+"',"

                +"'"+ct1_txt_lote.getText()+"',"
                +"'"+ct2_txt_pieza.getText()+"',"
                +"'"+ct3_cbx_mp.getSelectedItem().toString()+"',"
                +"'"+ct4_cbx_entero_fracturado.getSelectedItem().toString()+"',"
                +"'"+ct5_txt_largo.getText()+"',"
                +"'"+ct7_cbx_ancho.getText()+"',"
                +"'"+ct9_txt_espesormaximo.getText()+"',"
                +"'"+ct11_txt_espesortalon.getText()+"',"
                +"'"+ct13_txt_anchotalon.getText()+"',"
                +"'"+ct15_cbx_rangoanchotalon.getSelectedItem()+"',"
                +"'"+ct16_txt_peso.getText()+"',"
                +"'"+ct17_txt_tamaño.getText()+"',"
                +"'"+ct18_txt_modulo_long_ancho.getText()+"',"
                +"'"+ct19_txt_modulo_ancho_espesor.getText()+"',"
                +"'"+ct20_cbx_forma_sup_talon.getSelectedItem().toString()+"',"                
                +"'"+ct21_txt_n_facetas_lascado.getText()+"',"                
                +"'"+ct22_cbx_intervalo_facetas_lascado.getSelectedItem()+"',"                
                +"'"+ct23_cbx_forma_base.getSelectedItem()+"',"                
                +"'"+ct24_cbx_origen_extraccion.getSelectedItem()+"',"                
                +"'"+ct25_cbx_corteza_caradorsal.getSelectedItem()+"',"                
                +"'"+ct26_cbx_corteza_talon.getSelectedItem()+"',"                
                +"'"+ct27_txt_observaciones.getText()+"'"                
                + ")");

            c.closeconnection();
            if (aux>0){
                cargarhojanueva(ct0_txt_codigo.getText(), ct2_txt_pieza.getText());
                limpiarcampos();
               
                consultarid();
                btn_eliminarregistro_Dt_contalon.setEnabled(false);
            }
        

            
        } catch (SQLException ex) {
            Logger.getLogger(DT_frame.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
    public void cargaridDT_contalon(int ID){

     java.sql.ResultSet rs=null;       
        try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT * FROM DT_CONTALON2 WHERE (ID_DT_CONTALON="+ID+")");
             
             while(rs.next()){
                 ct0_txt_codigo .setText(String.valueOf(rs.getInt("ID_DT_CONTALON")));
                 ct1_txt_lote.setText(rs.getString("LOTE"));
                 ct2_txt_pieza.setText(rs.getString("PIEZA"));
                 ct3_cbx_mp.setSelectedItem(rs.getString("MP"));
                 ct4_cbx_entero_fracturado.setSelectedItem(rs.getString("ENTERO_FRACTURADO"));
                 ct5_txt_largo.setText(rs.getString("LARGO"));
                 ct7_cbx_ancho.setText(rs.getString("ANCHO"));
                 ct9_txt_espesormaximo.setText(rs.getString("ESPESOR_MAX"));
                 ct11_txt_espesortalon.setText(rs.getString("ESPESOR_TALON"));
                 ct13_txt_anchotalon.setText(rs.getString("ANCHO_TALON"));
                 ct15_cbx_rangoanchotalon.setSelectedItem(rs.getString("RANGO_ANCHO_TALON"));
                 ct16_txt_peso.setText(rs.getString("PESO"));
                 ct17_txt_tamaño.setText(rs.getString("TAMAÑO"));
                 ct18_txt_modulo_long_ancho.setText(rs.getString("MODULO_LONG_ANCHO"));
                 ct19_txt_modulo_ancho_espesor.setText(rs.getString("MODULO_ANCHO_ESPESOR"));
                 ct20_cbx_forma_sup_talon.setSelectedItem(rs.getString("FORMA_SUP_TALON"));
                 ct21_txt_n_facetas_lascado.setText(rs.getString("N_FACETAS_LASCADO"));
                 ct22_cbx_intervalo_facetas_lascado.setSelectedItem(rs.getString("N_INTERVALO_FACETAS_LASCADO"));
                 ct23_cbx_forma_base.setSelectedItem(rs.getString("FORMA_BASE"));
                 ct24_cbx_origen_extraccion.setSelectedItem(rs.getString("ORIGEN_EXTRACCION"));
                 ct25_cbx_corteza_caradorsal.setSelectedItem(rs.getString("CORTEZA_CARA_DORSAL"));
                 ct26_cbx_corteza_talon.setSelectedItem(rs.getString("CORTEZA_TALON"));
                 ct27_txt_observaciones.setText(rs.getString("OBSERVACIONES"));
                 
                 zona_ambiental=rs.getString("ZONA_AMBIENTAL");
                 localidad=rs.getString("LOCALIDAD");
                 sitio=rs.getString("SITIO");
                 siglasitio=rs.getString("SIGLA_SITIO");
                 capa_nivel=rs.getString("CAPA_NIVEL");
                 estruct_arq=rs.getString("ESTRUC_ARQ");
                 piso_subcapa=rs.getString("PISO_SUBCAPA");
                 tipo_estruct_planta=rs.getString("ESTRUC_PLANTA");
                 nombre_estruct_planta=rs.getString("NOMBRE_ESTRUC_PLANTA");
                 episodio_estruct_planta=rs.getString("EPISODIO_ESTRUC_PLANTA");
                 cuadro=rs.getString("CUADRO");
                 microsector=rs.getString("MICROSECTOR");
                }
        
        c.closeconnection();
       } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
    
    cargarchecks();
    
}

    private void cargarchecks(){
        bagolini_tamaños b = new bagolini_tamaños();
        b.chkfracturado(ct5_txt_largo, ct6_chk_largofracturado );
        b.chkfracturado(ct7_cbx_ancho,ct8_chk_anchofracturado);
        b.chkfracturado(ct9_txt_espesormaximo,ct10_chk_espesormaximofracturado);
        b.chkfracturado(ct11_txt_espesortalon,ct12_chk_espesortalonfracturado);
        b.chkfracturado(ct13_txt_anchotalon,ct14_chk_anchotalonfracturado);

    }
    
    private void cargarhojanueva(String id, String pieza){
    DefaultTreeModel model = (DefaultTreeModel) DT_frame.arbol_DT.getModel();        
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
DefaultMutableTreeNode leaf = (DefaultMutableTreeNode) root.getChildAt(1);
MutableTreeNode hoja = new DefaultMutableTreeNode("CT-"+id+"/"+pieza);
leaf.insert(hoja, leaf.getChildCount());
model.reload();

int j = DT_frame.arbol_DT.getRowCount();
       int i = 0;
       while(i < j) {
           DT_frame.arbol_DT.expandRow(i);
           i += 1;
           j = DT_frame.arbol_DT.getRowCount();
       }



}
private void validarcampos(){
    ValidarCampos val = new ValidarCampos();
    val.validarcampostxt(ct0_txt_codigo);
    val.validarcampostxt(ct1_txt_lote);
    val.validarcampostxt(ct2_txt_pieza);
    val.validarcamposcbx(ct3_cbx_mp);
    val.validarcamposcbx(ct4_cbx_entero_fracturado);
    val.validarcampostxt(ct5_txt_largo);
    val.validarcampostxt(ct7_cbx_ancho);
    val.validarcampostxt(ct9_txt_espesormaximo);
    val.validarcampostxt(ct11_txt_espesortalon);
    val.validarcampostxt(ct13_txt_anchotalon);
    val.validarcamposcbx(ct15_cbx_rangoanchotalon);
    val.validarcampostxt(ct16_txt_peso);
    val.validarcampostxt(ct17_txt_tamaño);
    val.validarcampostxt(ct18_txt_modulo_long_ancho);
    val.validarcampostxt(ct19_txt_modulo_ancho_espesor);
    val.validarcamposcbx(ct20_cbx_forma_sup_talon);
    val.validarcampostxt(ct21_txt_n_facetas_lascado);
    val.validarcamposcbx(ct22_cbx_intervalo_facetas_lascado);
    val.validarcamposcbx(ct23_cbx_forma_base);
    val.validarcamposcbx(ct24_cbx_origen_extraccion);
    val.validarcamposcbx(ct25_cbx_corteza_caradorsal);
    val.validarcamposcbx(ct26_cbx_corteza_talon);
    val.validarcampostxtarea(ct27_txt_observaciones);
    
}
    private void ct13_txt_anchotalonKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct13_txt_anchotalonKeyTyped

        char caracter = evt.getKeyChar();
        if (((caracter < '0') || (caracter > '9')) && (caracter != evt.VK_BACK_SPACE)
            && (caracter != '.') ) {
            evt.consume();
        }
    }//GEN-LAST:event_ct13_txt_anchotalonKeyTyped

    private void ct11_txt_espesortalonKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct11_txt_espesortalonKeyTyped

        char caracter = evt.getKeyChar();
        if (((caracter < '0') || (caracter > '9')) && (caracter != evt.VK_BACK_SPACE)
            && (caracter != '.') ) {
            evt.consume();
        }
    }//GEN-LAST:event_ct11_txt_espesortalonKeyTyped

    private void ct9_txt_espesormaximoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct9_txt_espesormaximoKeyTyped

        char caracter = evt.getKeyChar();
        if (((caracter < '0') || (caracter > '9')) && (caracter != evt.VK_BACK_SPACE)
            && (caracter != '.') ) {
            evt.consume();
        }
    }//GEN-LAST:event_ct9_txt_espesormaximoKeyTyped

    private void ct7_cbx_anchoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct7_cbx_anchoKeyTyped

        char caracter = evt.getKeyChar();
        if (((caracter < '0') || (caracter > '9')) && (caracter != evt.VK_BACK_SPACE)
            && (caracter != '.') ) {
            evt.consume();
        }
    }//GEN-LAST:event_ct7_cbx_anchoKeyTyped

    private void ct5_txt_largoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct5_txt_largoKeyTyped

        char caracter = evt.getKeyChar();
        if (((caracter < '0') || (caracter > '9')) && (caracter != evt.VK_BACK_SPACE)
            && (caracter != '.') ) {
            evt.consume();
        }
    }//GEN-LAST:event_ct5_txt_largoKeyTyped

    private void ct17_txt_tamañoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct17_txt_tamañoKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_ct17_txt_tamañoKeyTyped

    private void ct18_txt_modulo_long_anchoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct18_txt_modulo_long_anchoKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_ct18_txt_modulo_long_anchoKeyTyped

    private void ct19_txt_modulo_ancho_espesorKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct19_txt_modulo_ancho_espesorKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_ct19_txt_modulo_ancho_espesorKeyTyped

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
if((ct5_txt_largo.getText().equals(""))||(ct7_cbx_ancho.getText().equals(""))||(ct9_txt_espesormaximo.equals(""))){
        JOptionPane.showMessageDialog(null, "No se pueden efectuar los cálculos automáticos porque faltan atributos dimensionales");
    }else{

        bagolini_tamaños bag = new bagolini_tamaños(ct5_txt_largo.getText(), ct7_cbx_ancho.getText(),ct9_txt_espesormaximo.getText());
        ct17_txt_tamaño.setText(bag.getTamañob());
        ct19_txt_modulo_ancho_espesor.setText(bag.getModuloanchoespesor());
        ct18_txt_modulo_long_ancho.setText(bag.getModuloLong_Ancho());
    
}
        try {
            float anchotalon = Float.parseFloat(ct13_txt_anchotalon.getText());
            
            if(anchotalon<0.2){
                ct15_cbx_rangoanchotalon.setSelectedItem("1- (<2mm)");
            }else if((anchotalon>=0.2)&&(anchotalon<=0.7)){
                ct15_cbx_rangoanchotalon.setSelectedItem("2- (2-7mm)");
            }else if(anchotalon>0.7){
                ct15_cbx_rangoanchotalon.setSelectedItem("3- (>7mm)");
            }else{
                 ct15_cbx_rangoanchotalon.setSelectedItem("CN");
            }
            
            

        } catch (Exception e) {
        }

    }//GEN-LAST:event_jButton4ActionPerformed

    private void ct16_txt_pesoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct16_txt_pesoKeyTyped
        char caracter = evt.getKeyChar();
        if (((caracter < '0') || (caracter > '9')) && (caracter != evt.VK_BACK_SPACE)
            && (caracter != '.') ) {
            evt.consume();
        }
    }//GEN-LAST:event_ct16_txt_pesoKeyTyped

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        JOptionPane.showMessageDialog(null, "--- Cálculo de Tamaño: según índices de Aschero, toma Largo y Ancho [1,4]"
            + "\n--- Cálculo de Módulo Largo/Ancho: según Bagolini, toma Largo y Ancho "
            + "\n--- Cálculo de Módulo Ancho/Espesor: según índices de Achero, toma Ancho y Espesor max.");

    }//GEN-LAST:event_jButton6ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        sumadora_pesos sum = new sumadora_pesos();
        sum.setVisible(true);
        sumadora_llevar_peso="con_talon";
    }//GEN-LAST:event_jButton7ActionPerformed

    private void ct21_txt_n_facetas_lascadoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct21_txt_n_facetas_lascadoKeyTyped

        char caracter = evt.getKeyChar();
        if (((caracter < '0') || (caracter > '9')) && (caracter != evt.VK_BACK_SPACE)
            && (caracter != '.') ) {
            evt.consume();
        }
    }//GEN-LAST:event_ct21_txt_n_facetas_lascadoKeyTyped

    private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
Cargar_MP cargartodasMP = new Cargar_MP();
cargartodasMP.cargar_todas_mp(ct3_cbx_mp);
consultarid();
    }//GEN-LAST:event_formInternalFrameOpened

    private void consultarid(){
    InteraccionesBD inter = new InteraccionesBD();
    int id = inter.obtenersiguienteID("DT_CONTALON2", "ID_DT_CONTALON");
    ct0_txt_codigo.setText(String.valueOf(id));
}  
    private void ct3_cbx_mpItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ct3_cbx_mpItemStateChanged
indexMP = ct3_cbx_mp.getSelectedIndex();

    }//GEN-LAST:event_ct3_cbx_mpItemStateChanged

    private void INGRESAR1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_INGRESAR1ActionPerformed
limpiarcampos();
    }//GEN-LAST:event_INGRESAR1ActionPerformed

    private void btn_eliminarregistro_Dt_contalonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_eliminarregistro_Dt_contalonActionPerformed
eliminaridDT_CONTALON(Integer.parseInt(ct0_txt_codigo.getText()));
    }//GEN-LAST:event_btn_eliminarregistro_Dt_contalonActionPerformed

    private void ct6_chk_largofracturadoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ct6_chk_largofracturadoItemStateChanged
bagolini_tamaños bag = new bagolini_tamaños();
bag.fracturado(ct5_txt_largo, ct6_chk_largofracturado);
    }//GEN-LAST:event_ct6_chk_largofracturadoItemStateChanged

    private void ct8_chk_anchofracturadoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ct8_chk_anchofracturadoItemStateChanged
bagolini_tamaños bag = new bagolini_tamaños();
bag.fracturado(ct7_cbx_ancho, ct8_chk_anchofracturado);
    }//GEN-LAST:event_ct8_chk_anchofracturadoItemStateChanged

    private void ct10_chk_espesormaximofracturadoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ct10_chk_espesormaximofracturadoItemStateChanged
bagolini_tamaños bag = new bagolini_tamaños();
bag.fracturado(ct9_txt_espesormaximo, ct10_chk_espesormaximofracturado);
    }//GEN-LAST:event_ct10_chk_espesormaximofracturadoItemStateChanged

    private void ct12_chk_espesortalonfracturadoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ct12_chk_espesortalonfracturadoItemStateChanged
bagolini_tamaños bag = new bagolini_tamaños();
bag.fracturado(ct11_txt_espesortalon, ct12_chk_espesortalonfracturado);
    }//GEN-LAST:event_ct12_chk_espesortalonfracturadoItemStateChanged

    private void ct14_chk_anchotalonfracturadoItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ct14_chk_anchotalonfracturadoItemStateChanged
bagolini_tamaños bag = new bagolini_tamaños();
bag.fracturado(ct13_txt_anchotalon, ct14_chk_anchotalonfracturado);
    }//GEN-LAST:event_ct14_chk_anchotalonfracturadoItemStateChanged

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
if((!ct5_txt_largo.getText().equals(""))&&(!ct7_cbx_ancho.getText().equals(""))&&(!ct9_txt_espesormaximo.getText().equals(""))){
    

if((ct6_chk_largofracturado.isSelected()==false)&&(ct8_chk_anchofracturado.isSelected()==false)&&(ct10_chk_espesormaximofracturado.isSelected()==false)){
    Bagolini_new bag = new Bagolini_new();
bag.setVisible(true);
Bagolini_new.Escritorio.removeAll();
Internal_Bagolini bagol = new Internal_Bagolini();
Bagolini_new.Escritorio.add(bagol);
bagol.show();
bagol.calculoautombagolini(ct5_txt_largo.getText(), ct7_cbx_ancho.getText(), ct9_txt_espesormaximo.getText());
}else{
    JOptionPane.showMessageDialog(null, "No se puede cargar el gráfico porque existe alguna dimensión fracturada");
}
}else{
    JOptionPane.showMessageDialog(null, "Para ver el gráfico, debe ingresar largo, ancho y espesor máximo de la pieza");
}
    }//GEN-LAST:event_jButton8ActionPerformed

    private void ct27_txt_observacionesKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct27_txt_observacionesKeyTyped
if (ct27_txt_observaciones.getText().length()== 500){
    evt.consume();
}
    }//GEN-LAST:event_ct27_txt_observacionesKeyTyped

    private void ct27_txt_observacionesKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ct27_txt_observacionesKeyPressed
if (evt.getKeyChar() != evt.VK_ENTER && evt.getKeyChar() != evt.VK_TAB)
				{
				} else {
   
    evt.consume();
    }
    }//GEN-LAST:event_ct27_txt_observacionesKeyPressed

    private void ct23_cbx_forma_baseItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ct23_cbx_forma_baseItemStateChanged
     if(ct23_cbx_forma_base.getSelectedItem().toString().equals("LsPl-Lasca plana")){
         ct21_txt_n_facetas_lascado.setText("0");
         ct22_cbx_intervalo_facetas_lascado.setSelectedItem("CN");
     }else{
                  ct21_txt_n_facetas_lascado.setText("");
         ct22_cbx_intervalo_facetas_lascado.setSelectedIndex(0);
     }
    }//GEN-LAST:event_ct23_cbx_forma_baseItemStateChanged

    
    
public void eliminaridDT_CONTALON(int ID_PIEZA){
int confirma =0;
String sql = "DELETE FROM DT_CONTALON2 WHERE ID_DT_CONTALON="+ID_PIEZA;    
            try {
            conexion c = new conexion();
            c.getConexion();

            confirma = c.eliminar_actualizar(sql);
            c.closeconnection();
         
         if(confirma>0){
         JOptionPane.showMessageDialog(null, "Se eliminó el registro de la pieza: "+ID_PIEZA +"\n Nota: La procedencia de la misma está activa para un ingreso nuevo \n Si no desea trabajar con la misma, diríjase a la sección de procedencias");
         InteraccionesBD interac = new InteraccionesBD();
         interac.eliminarhojaarbol(arbol_DT, selectednodeparaeliminar);
         limpiarcampos();
         consultarid();
         btn_eliminarregistro_Dt_sintalon.setEnabled(false);
         }

        } catch (SQLException ex) {
            JOptionPane.showMessageDialog(null, "No se pudo eliminar el registro asociado a la pieza " + ID_PIEZA + ex);
        }
         
    
}
    private void limpiarcampos(){

Limpiar_campos aux = new Limpiar_campos();
aux.limpiartxt(ct1_txt_lote);
aux.limpiartxt(ct2_txt_pieza);
aux.limpiartxt(ct5_txt_largo);

aux.limpiartxt(ct7_cbx_ancho);
aux.limpiartxt(ct9_txt_espesormaximo);
aux.limpiartxt(ct11_txt_espesortalon);
aux.limpiartxt(ct13_txt_anchotalon);

aux.limpiartxt(ct16_txt_peso);
aux.limpiartxt(ct17_txt_tamaño);
aux.limpiartxt(ct18_txt_modulo_long_ancho);
aux.limpiartxt(ct19_txt_modulo_ancho_espesor);
aux.limpiartxt(ct21_txt_n_facetas_lascado);


aux.limpiarcbx(ct4_cbx_entero_fracturado);
aux.limpiarcbx(ct15_cbx_rangoanchotalon);
aux.limpiarcbx(ct20_cbx_forma_sup_talon);
aux.limpiarcbx(ct22_cbx_intervalo_facetas_lascado);
aux.limpiarcbx(ct23_cbx_forma_base);
aux.limpiarcbx(ct24_cbx_origen_extraccion);
aux.limpiarcbx(ct25_cbx_corteza_caradorsal);
aux.limpiarcbx(ct26_cbx_corteza_talon);

aux.limpiartxtarea(ct27_txt_observaciones);


aux.limpiarcheckbox(ct6_chk_largofracturado);
aux.limpiarcheckbox(ct8_chk_anchofracturado);
aux.limpiarcheckbox(ct10_chk_espesormaximofracturado);
aux.limpiarcheckbox(ct12_chk_espesortalonfracturado);
aux.limpiarcheckbox(ct14_chk_anchotalonfracturado);  
        
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton INGRESAR;
    private javax.swing.JButton INGRESAR1;
    public static javax.swing.JButton btn_eliminarregistro_Dt_contalon;
    private javax.swing.JTextField ct0_txt_codigo;
    private javax.swing.JCheckBox ct10_chk_espesormaximofracturado;
    private javax.swing.JTextField ct11_txt_espesortalon;
    private javax.swing.JCheckBox ct12_chk_espesortalonfracturado;
    private javax.swing.JTextField ct13_txt_anchotalon;
    private javax.swing.JCheckBox ct14_chk_anchotalonfracturado;
    private javax.swing.JComboBox<String> ct15_cbx_rangoanchotalon;
    public static javax.swing.JTextField ct16_txt_peso;
    private javax.swing.JTextField ct17_txt_tamaño;
    private javax.swing.JTextField ct18_txt_modulo_long_ancho;
    private javax.swing.JTextField ct19_txt_modulo_ancho_espesor;
    private javax.swing.JTextField ct1_txt_lote;
    private javax.swing.JComboBox<String> ct20_cbx_forma_sup_talon;
    private javax.swing.JTextField ct21_txt_n_facetas_lascado;
    private javax.swing.JComboBox<String> ct22_cbx_intervalo_facetas_lascado;
    private javax.swing.JComboBox<String> ct23_cbx_forma_base;
    private javax.swing.JComboBox<String> ct24_cbx_origen_extraccion;
    private javax.swing.JComboBox<String> ct25_cbx_corteza_caradorsal;
    private javax.swing.JComboBox<String> ct26_cbx_corteza_talon;
    private javax.swing.JTextArea ct27_txt_observaciones;
    private javax.swing.JTextField ct2_txt_pieza;
    private javax.swing.JComboBox<String> ct3_cbx_mp;
    private javax.swing.JComboBox<String> ct4_cbx_entero_fracturado;
    private javax.swing.JTextField ct5_txt_largo;
    private javax.swing.JCheckBox ct6_chk_largofracturado;
    private javax.swing.JTextField ct7_cbx_ancho;
    private javax.swing.JCheckBox ct8_chk_anchofracturado;
    private javax.swing.JTextField ct9_txt_espesormaximo;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    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 jLabel15;
    private javax.swing.JLabel jLabel16;
    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 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 jLabel3;
    private javax.swing.JLabel jLabel47;
    private javax.swing.JLabel jLabel48;
    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.JSeparator jSeparator1;
    private javax.swing.JLabel lbl12;
    // End of variables declaration//GEN-END:variables
}
