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

import static arql2020.ARQL2020.WHERE;
import static arql2020.ARQL2020.etiqueta_muestra;
import clases.InteraccionesBD;
import clases.conexion;
import java.awt.BorderLayout;
import java.awt.Color;
import java.beans.PropertyVetoException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

/**
 *
 * @author chuen
 */
public class F_Formatizacion_utiles1 extends javax.swing.JInternalFrame {

    /**
     * Creates new form F_Formatizacion_utiles1
     */
    public F_Formatizacion_utiles1() {
        initComponents();
                    try {
            this.setMaximum(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(B_Composicion_puntasfilossup.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() {

        botones1 = new javax.swing.ButtonGroup();
        botones2 = new javax.swing.ButtonGroup();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        cbx_compatible_tecnica = new javax.swing.JComboBox<>();
        jScrollPane4 = new javax.swing.JScrollPane();
        tbl3 = new javax.swing.JTable();
        jScrollPane6 = new javax.swing.JScrollPane();
        tbl4 = new javax.swing.JTable();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        txt_dt_en_tabla = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        txt_n_utiles = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        btn_copiar4 = new javax.swing.JButton();
        btn_arbol4 = new javax.swing.JButton();
        btn_info4 = new javax.swing.JButton();
        txt_utiles_en_tabla = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        txt_porc_sobreutiles = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txt_canDTCT = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        txt_porc_sobre_DT = new javax.swing.JTextField();
        jButton5 = new javax.swing.JButton();
        btn_copiar7 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tbl_clasetecnica_utiles = new javax.swing.JTable();
        jScrollPane9 = new javax.swing.JScrollPane();
        tbl_origenextrac_DT = new javax.swing.JTable();
        jScrollPane10 = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        jScrollPane11 = new javax.swing.JScrollPane();
        jTextArea3 = new javax.swing.JTextArea();
        btn_info3 = new javax.swing.JButton();
        btn_arbol3 = new javax.swing.JButton();
        btn_copiar3 = new javax.swing.JButton();
        BTN_REDUC_ADEL_UNIBIF = new javax.swing.JButton();
        btn_marginalunibi = new javax.swing.JButton();
        btn_copiar6 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        cbx_mp = new javax.swing.JComboBox<>();
        jButton3 = new javax.swing.JButton();
        txt_sentencia = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        txt_muestra = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        btn_calcular = new javax.swing.JButton();
        jLabel27 = new javax.swing.JLabel();
        txt_mp_selec = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jScrollPane14 = new javax.swing.JScrollPane();
        tbl_clasetec_estandar = new javax.swing.JTable();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane16 = new javax.swing.JScrollPane();
        tbl_clasetec_punta = new javax.swing.JTable();
        jButton6 = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jButton9 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        txt_clasetecnica = new javax.swing.JTextField();
        cbx_clasetecnica = new javax.swing.JComboBox<>();
        btn_info = new javax.swing.JButton();
        btn_arbol = new javax.swing.JButton();
        btn_copiar = new javax.swing.JButton();
        jScrollPane15 = new javax.swing.JScrollPane();
        tbl2 = new javax.swing.JTable();
        jLabel20 = new javax.swing.JLabel();
        txt1_piezas_analizadas = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        txt1_piezasnobip = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        txt1_cant_bipolar = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        txt_n_filospuntas = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        txt1_porc_Bipo = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        txt1_porc_nobip = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        txt1_n_utiles = new javax.swing.JTextField();
        jScrollPane13 = new javax.swing.JScrollPane();
        jTextArea4 = new javax.swing.JTextArea();
        jLabel21 = new javax.swing.JLabel();
        txt1_piezas_sobreutiles = new javax.swing.JTextField();
        jButton7 = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        btn_copiar1 = new javax.swing.JButton();
        btn_arbol1 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tbl = new javax.swing.JTable();
        jpanelA = new javax.swing.JPanel();
        jpanelB = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        btn_arbol2 = new javax.swing.JButton();
        btn_copiar2 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tbl1 = new javax.swing.JTable();
        jpanelC = new javax.swing.JPanel();
        jpanelD = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jScrollPane12 = new javax.swing.JScrollPane();
        tbl7 = new javax.swing.JTable();
        jpanelE = new javax.swing.JPanel();
        jpanelF = new javax.swing.JPanel();
        btn_copiar5 = new javax.swing.JButton();

        setClosable(true);
        setMaximizable(true);
        setResizable(true);
        setTitle("Formatización según procedimientos técnicos");
        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);
            }
        });

        jPanel2.setBackground(new java.awt.Color(255, 204, 204));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Compatibilidad procedim. tec. form. utiles y anchos talones en DT", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        cbx_compatible_tecnica.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        cbx_compatible_tecnica.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Seleccione", "Compatible con retalla", "Compatible con retoque", "Compatible con microrretoque" }));

        tbl3.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "UTILES- Codigo ARQ.L"
            }
        ));
        tbl3.setRowHeight(20);
        jScrollPane4.setViewportView(tbl3);
        if (tbl3.getColumnModel().getColumnCount() > 0) {
            tbl3.getColumnModel().getColumn(0).setResizable(false);
        }

        tbl4.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "DT- Codigo ARQ.L"
            }
        ));
        tbl4.setRowHeight(20);
        jScrollPane6.setViewportView(tbl4);
        if (tbl4.getColumnModel().getColumnCount() > 0) {
            tbl4.getColumnModel().getColumn(0).setResizable(false);
        }

        jTextArea1.setColumns(20);
        jTextArea1.setLineWrap(true);
        jTextArea1.setRows(5);
        jTextArea1.setText("DESCRIPCION.\nCOMPATIBLES CON RETALLA\nRetalla y/o retalla bipolar en utiles / Rango 1 en talon de DT\n\nCOMPATIBLES CON RETOQUE\nRetoque en utiles / Rango 2 en talon de DT\n\nCOMPATIBLES CON MICRORRETOQUE\nMicrorretoque en utiles / Rango 3 en talon de DT");
        jTextArea1.setWrapStyleWord(true);
        jScrollPane7.setViewportView(jTextArea1);

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

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel2.setText("N DT con talón en la tabla");

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

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setText("N total de útiles");

        btn_copiar4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar4.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiar4ActionPerformed(evt);
            }
        });

        btn_arbol4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arbol.png"))); // NOI18N
        btn_arbol4.setToolTipText("Arbol: CLASES ARTEFACTUALES PRESENTES EN LA MP SELECCIONADA");
        btn_arbol4.setEnabled(false);
        btn_arbol4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_arbol4ActionPerformed(evt);
            }
        });

        btn_info4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/info.png"))); // NOI18N
        btn_info4.setToolTipText("Información sobre el análisis");
        btn_info4.setEnabled(false);
        btn_info4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_info4ActionPerformed(evt);
            }
        });

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

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel6.setText("N de útiles en la tabla");

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

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel7.setText("% sobre total de útiles");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel8.setText("N total de DT con talón");

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

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel9.setText("% sobre total de DT");

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

        jButton5.setBackground(new java.awt.Color(204, 255, 0));
        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lentes.png"))); // NOI18N
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        btn_copiar7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar7.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiar7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(cbx_compatible_tecnica, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(btn_info4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btn_arbol4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btn_copiar4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(txt_utiles_en_tabla, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel6))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(txt_porc_sobreutiles, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel7))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(txt_n_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel3))))
                        .addGap(58, 58, 58)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(txt_dt_en_tabla, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel2))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(txt_canDTCT, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel8))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(txt_porc_sobre_DT, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel9))))
                    .addComponent(btn_copiar7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 424, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(56, 56, 56))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btn_arbol4, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btn_info4, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jButton5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(cbx_compatible_tecnica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(21, 21, 21)
                                .addComponent(btn_copiar4, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(btn_copiar7, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(7, 7, 7)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txt_dt_en_tabla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel2))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txt_canDTCT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel8))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txt_porc_sobre_DT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel9)))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txt_utiles_en_tabla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel6))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txt_n_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel3))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txt_porc_sobreutiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel7))))
                        .addGap(0, 62, Short.MAX_VALUE))
                    .addComponent(jScrollPane7))
                .addContainerGap())
        );

        jPanel3.setBackground(new java.awt.Color(153, 255, 204));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Compatibilidad clases técnicas de útiles y origen de la extracción en DT", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        tbl_clasetecnica_utiles.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl_clasetecnica_utiles.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Clases tecnicas utiles", "Cantidad", "%"
            }
        ));
        tbl_clasetecnica_utiles.setRowHeight(25);
        jScrollPane8.setViewportView(tbl_clasetecnica_utiles);
        if (tbl_clasetecnica_utiles.getColumnModel().getColumnCount() > 0) {
            tbl_clasetecnica_utiles.getColumnModel().getColumn(0).setResizable(false);
        }

        tbl_origenextrac_DT.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl_origenextrac_DT.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Origen ext. DT", "Cantidad", "%"
            }
        ));
        tbl_origenextrac_DT.setRowHeight(25);
        jScrollPane9.setViewportView(tbl_origenextrac_DT);
        if (tbl_origenextrac_DT.getColumnModel().getColumnCount() > 0) {
            tbl_origenextrac_DT.getColumnModel().getColumn(0).setResizable(false);
        }

        jTextArea2.setColumns(20);
        jTextArea2.setLineWrap(true);
        jTextArea2.setRows(5);
        jTextArea2.setText("DESCRIPCION.\nREDUCCION Y ADELGAZ UNI/BIFACIAL\n\nUTILES \nClase técnica:\n1. Artefactos con adelgazamiento bifacial.\n2. Con reducción bifacial.\n4. adelgazamiento unifacial.\n5. Reducción unifacial.\n\nDT:\nOrigen de la extracción:\n1. Adelg/Reduc bifacial\n");
        jTextArea2.setWrapStyleWord(true);
        jScrollPane10.setViewportView(jTextArea2);

        jTextArea3.setColumns(20);
        jTextArea3.setLineWrap(true);
        jTextArea3.setRows(5);
        jTextArea3.setText("DESCRIPCION.\nMARGINAL UNI/BIFACIAL\n\nUTILES:\nClase técnica:\n3. Bifaciales-marginales.\n6. Unifaciales marginales.\n7. Talla de extraccion sin format.\n\nDT:\nOrigen de la extracción\n2.React. Direc. Filos\n3. React Invers. Filos\n4. React plataf.\n5. Reac frent extrac");
        jTextArea3.setWrapStyleWord(true);
        jScrollPane11.setViewportView(jTextArea3);

        btn_info3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/info.png"))); // NOI18N
        btn_info3.setToolTipText("Información sobre el análisis");
        btn_info3.setEnabled(false);
        btn_info3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_info3ActionPerformed(evt);
            }
        });

        btn_arbol3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arbol.png"))); // NOI18N
        btn_arbol3.setToolTipText("Arbol: CLASES ARTEFACTUALES PRESENTES EN LA MP SELECCIONADA");
        btn_arbol3.setEnabled(false);
        btn_arbol3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_arbol3ActionPerformed(evt);
            }
        });

        btn_copiar3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar3.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiar3ActionPerformed(evt);
            }
        });

        BTN_REDUC_ADEL_UNIBIF.setBackground(new java.awt.Color(204, 255, 0));
        BTN_REDUC_ADEL_UNIBIF.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        BTN_REDUC_ADEL_UNIBIF.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lentes.png"))); // NOI18N
        BTN_REDUC_ADEL_UNIBIF.setText("REDUCCION Y ADELGAZ UNI/BIFACIAL");
        BTN_REDUC_ADEL_UNIBIF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BTN_REDUC_ADEL_UNIBIFActionPerformed(evt);
            }
        });

        btn_marginalunibi.setBackground(new java.awt.Color(204, 255, 0));
        btn_marginalunibi.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        btn_marginalunibi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lentes.png"))); // NOI18N
        btn_marginalunibi.setText("MARGINAL UNI/BIFACIAL");
        btn_marginalunibi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_marginalunibiActionPerformed(evt);
            }
        });

        btn_copiar6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar6.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiar6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(BTN_REDUC_ADEL_UNIBIF)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 297, Short.MAX_VALUE)
                                .addComponent(btn_info3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btn_arbol3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(45, 45, 45))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addGap(0, 0, Short.MAX_VALUE)
                                        .addComponent(btn_copiar6, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addGap(0, 0, Short.MAX_VALUE)
                                        .addComponent(btn_copiar3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addGap(10, 10, 10))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(btn_marginalunibi, javax.swing.GroupLayout.PREFERRED_SIZE, 311, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
                    .addComponent(jScrollPane11))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(btn_arbol3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(btn_info3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(BTN_REDUC_ADEL_UNIBIF, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btn_marginalunibi, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(8, 8, 8)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btn_copiar6, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btn_copiar3, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)))
                .addContainerGap())
        );

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

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

        jButton3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton3.setText("MP PRESENTES EN LA MUESTRA");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

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

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

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

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel15.setText("Cálculo realizado sobre muestra:");

        btn_calcular.setBackground(new java.awt.Color(204, 255, 0));
        btn_calcular.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lentes.png"))); // NOI18N
        btn_calcular.setToolTipText("Realizar análisis");
        btn_calcular.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                btn_calcularComponentHidden(evt);
            }
        });
        btn_calcular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_calcularActionPerformed(evt);
            }
        });

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

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

        jPanel4.setBackground(new java.awt.Color(255, 255, 255));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Técnicas de formatización sobre útiles", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel12.setText("Clases técnicas asociadas a fichas segmentales estándar");

        tbl_clasetec_estandar.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl_clasetec_estandar.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Clase técnica"
            }
        ));
        tbl_clasetec_estandar.setRowHeight(25);
        tbl_clasetec_estandar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl_clasetec_estandarMouseClicked(evt);
            }
        });
        jScrollPane14.setViewportView(tbl_clasetec_estandar);

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel13.setText("Clases técnicas asociadas a fichas de punta de proy.");

        tbl_clasetec_punta.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl_clasetec_punta.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Clase técnica"
            }
        ));
        tbl_clasetec_punta.setRowHeight(25);
        tbl_clasetec_punta.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl_clasetec_puntaMouseClicked(evt);
            }
        });
        jScrollPane16.setViewportView(tbl_clasetec_punta);

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

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel11.setText("Análisis realizado sobre: ");

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

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Seleccione una clase técnica");

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

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

        btn_info.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/info.png"))); // NOI18N
        btn_info.setToolTipText("Información sobre el análisis");
        btn_info.setEnabled(false);
        btn_info.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_infoActionPerformed(evt);
            }
        });

        btn_arbol.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arbol.png"))); // NOI18N
        btn_arbol.setToolTipText("Arbol: CLASES ARTEFACTUALES PRESENTES EN LA MP SELECCIONADA");
        btn_arbol.setEnabled(false);
        btn_arbol.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_arbolActionPerformed(evt);
            }
        });

        btn_copiar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiarActionPerformed(evt);
            }
        });

        tbl2.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "COD GRAL", "COD SEG", "GRUPO TIP", "TALLA NO BIP", "TALLA BIP", "FORMA-BASE BIP", "RETALLA", "RETOQUE", "MICRO", "RETALAL BIP", "RETOQUE BIP", "PICADO", "ALISADO", "PULIDO", "ABRASION", "NO PERT.", "NO DIF."
            }
        ));
        tbl2.setRowHeight(25);
        tbl2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl2MouseClicked(evt);
            }
        });
        jScrollPane15.setViewportView(tbl2);
        if (tbl2.getColumnModel().getColumnCount() > 0) {
            tbl2.getColumnModel().getColumn(1).setHeaderValue("COD SEG");
            tbl2.getColumnModel().getColumn(2).setHeaderValue("GRUPO TIP");
            tbl2.getColumnModel().getColumn(3).setHeaderValue("TALLA NO BIP");
            tbl2.getColumnModel().getColumn(4).setHeaderValue("TALLA BIP");
            tbl2.getColumnModel().getColumn(5).setHeaderValue("FORMA-BASE BIP");
            tbl2.getColumnModel().getColumn(6).setHeaderValue("RETALLA");
            tbl2.getColumnModel().getColumn(7).setHeaderValue("RETOQUE");
            tbl2.getColumnModel().getColumn(8).setHeaderValue("MICRO");
            tbl2.getColumnModel().getColumn(9).setHeaderValue("RETALAL BIP");
            tbl2.getColumnModel().getColumn(10).setHeaderValue("RETOQUE BIP");
            tbl2.getColumnModel().getColumn(11).setHeaderValue("PICADO");
            tbl2.getColumnModel().getColumn(12).setHeaderValue("ALISADO");
            tbl2.getColumnModel().getColumn(13).setHeaderValue("PULIDO");
            tbl2.getColumnModel().getColumn(14).setHeaderValue("ABRASION");
            tbl2.getColumnModel().getColumn(15).setHeaderValue("NO PERT.");
            tbl2.getColumnModel().getColumn(16).setHeaderValue("NO DIF.");
        }

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel20.setText("a. N° cant piezas analizadas");

        txt1_piezas_analizadas.setEditable(false);
        txt1_piezas_analizadas.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt1_piezas_analizadas.setText("0");

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel18.setText("B. cant piezas no bip.");

        txt1_piezasnobip.setEditable(false);
        txt1_piezasnobip.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt1_piezasnobip.setText("0");
        txt1_piezasnobip.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txt1_piezasnobipActionPerformed(evt);
            }
        });

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel19.setText("C. cant piezas con talla o form. bip.");

        txt1_cant_bipolar.setEditable(false);
        txt1_cant_bipolar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt1_cant_bipolar.setText("0");

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel22.setText("D. cant filos+puntas");

        txt_n_filospuntas.setEditable(false);
        txt_n_filospuntas.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt_n_filospuntas.setText("0");

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel26.setText("% cant piezas con talla o form. bip. sobre el total de útiles");

        txt1_porc_Bipo.setEditable(false);
        txt1_porc_Bipo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt1_porc_Bipo.setText("0");

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel23.setText("% cant piezas no bip. sobre el total de útiles");

        txt1_porc_nobip.setEditable(false);
        txt1_porc_nobip.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt1_porc_nobip.setText("0");

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel25.setText("N total de útiles");

        txt1_n_utiles.setEditable(false);
        txt1_n_utiles.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt1_n_utiles.setText("0");

        jTextArea4.setColumns(20);
        jTextArea4.setLineWrap(true);
        jTextArea4.setRows(5);
        jTextArea4.setText("Descripción:\nLa cantidad de piezas con talla o formatizacion bipolar cuenta aquellas en donde existe al menos un un aspecto bipolar, ya sea en su forma base (lascas bipolares o nodulos con talla bipolar) o bien, al menos un procedimimiento tecnico de formatizacion bipolar.\nSi la pieza no tiene al menos un rasgo bipolar, se considera \"pieza no bipolar\". \nLos valores que siguen al cuadro (piezas analizadas, bipolares, no bipolares) se efectúan sobre el \"sí\" de las tablas. Es decir: la bipolaridad se cuenta cuando hay al menos un \"sí\" en las columnas correspondientes a talla bipolar. Las no-bipolares se cuentan cuando hay al menos un \"sí\" en la columna no-bipolar. Con respecto a esto último, recuerde indicar en la sección de técnicas de formatización cuando se trate de talla de extracción no-bipolar. ");
        jTextArea4.setWrapStyleWord(true);
        jScrollPane13.setViewportView(jTextArea4);

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel21.setText("% piezas analizadas sobre el total de útiles");

        txt1_piezas_sobreutiles.setEditable(false);
        txt1_piezas_sobreutiles.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        txt1_piezas_sobreutiles.setText("0");

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

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(btn_info, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btn_arbol, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btn_copiar, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addGap(6, 6, 6)
                                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jLabel11)
                                            .addComponent(jLabel5))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txt_clasetecnica, javax.swing.GroupLayout.PREFERRED_SIZE, 398, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(cbx_clasetecnica, javax.swing.GroupLayout.PREFERRED_SIZE, 428, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(jButton6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 16, Short.MAX_VALUE)
                                        .addComponent(jButton9))
                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel4Layout.createSequentialGroup()
                                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addComponent(jLabel19)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(txt1_cant_bipolar, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addComponent(jLabel18)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(txt1_piezasnobip, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addComponent(jLabel20)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(txt1_piezas_analizadas, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addComponent(jLabel22)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(txt_n_filospuntas, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addComponent(jLabel25)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(txt1_n_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addGap(43, 43, 43)
                                                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                            .addGroup(jPanel4Layout.createSequentialGroup()
                                                                .addComponent(jLabel26)
                                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                .addComponent(txt1_porc_Bipo, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                            .addGroup(jPanel4Layout.createSequentialGroup()
                                                                .addComponent(jLabel23)
                                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                .addComponent(txt1_porc_nobip, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                            .addGroup(jPanel4Layout.createSequentialGroup()
                                                                .addComponent(jLabel21)
                                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                                .addComponent(txt1_piezas_sobreutiles, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                                    .addGroup(jPanel4Layout.createSequentialGroup()
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(jButton7))))
                                            .addGroup(jPanel4Layout.createSequentialGroup()
                                                .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(152, 152, 152)
                                                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, 337, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jLabel13))))
                                        .addGap(0, 0, Short.MAX_VALUE)))
                                .addGap(0, 189, Short.MAX_VALUE))))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane15, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane13))))
                .addContainerGap())
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jScrollPane14, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jScrollPane16, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btn_arbol, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btn_copiar, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(btn_info, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(43, 43, 43)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel11))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(cbx_clasetecnica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton6)
                            .addComponent(jButton9))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txt_clasetecnica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane15, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel25)
                    .addComponent(txt1_n_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel20)
                    .addComponent(txt1_piezas_analizadas, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21)
                    .addComponent(txt1_piezas_sobreutiles, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel18)
                    .addComponent(txt1_piezasnobip, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23)
                    .addComponent(txt1_porc_nobip, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel19)
                    .addComponent(txt1_cant_bipolar, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel26)
                    .addComponent(txt1_porc_Bipo, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(txt_n_filospuntas, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel5.setBackground(new java.awt.Color(255, 255, 255));
        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Tamaños por clase técnica (100% fichas generales)", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        btn_copiar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar1.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiar1ActionPerformed(evt);
            }
        });

        btn_arbol1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arbol.png"))); // NOI18N
        btn_arbol1.setToolTipText("Arbol: CLASES ARTEFACTUALES PRESENTES EN LA MP SELECCIONADA");
        btn_arbol1.setEnabled(false);
        btn_arbol1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_arbol1ActionPerformed(evt);
            }
        });

        jButton1.setBackground(new java.awt.Color(204, 255, 0));
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lentes.png"))); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        tbl.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "CLASE TECNICA", "TAMAÑO 1", "TAMAÑO 2", "TAMAÑO 3", "TAMAÑO 4", "%"
            }
        ));
        tbl.setRowHeight(25);
        tbl.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tbl);

        jpanelA.setBackground(new java.awt.Color(204, 204, 204));
        jpanelA.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpanelA.setLayout(new java.awt.BorderLayout());

        jpanelB.setBackground(new java.awt.Color(204, 204, 204));
        jpanelB.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpanelB.setLayout(new java.awt.BorderLayout());

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btn_arbol1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btn_copiar1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane2)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                        .addComponent(jpanelA, javax.swing.GroupLayout.PREFERRED_SIZE, 522, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 128, Short.MAX_VALUE)
                        .addComponent(jpanelB, javax.swing.GroupLayout.PREFERRED_SIZE, 522, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btn_arbol1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(btn_copiar1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addGap(22, 22, 22)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(49, 49, 49)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jpanelA, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jpanelB, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(51, Short.MAX_VALUE))
        );

        jPanel6.setBackground(new java.awt.Color(255, 255, 255));
        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Origen de la extracción y laminaridad en útiles", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        btn_arbol2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/arbol.png"))); // NOI18N
        btn_arbol2.setToolTipText("Arbol: CLASES ARTEFACTUALES PRESENTES EN LA MP SELECCIONADA");
        btn_arbol2.setEnabled(false);
        btn_arbol2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_arbol2ActionPerformed(evt);
            }
        });

        btn_copiar2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar2.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiar2ActionPerformed(evt);
            }
        });

        jButton2.setBackground(new java.awt.Color(204, 255, 0));
        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lentes.png"))); // NOI18N
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel1.setText("Módulos laminares: A, B y C.");

        tbl1.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "ORIGEN DE LA EXT.", "NO LAMINAR", "LAMINAR", "%"
            }
        ));
        tbl1.setRowHeight(25);
        tbl1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl1MouseClicked(evt);
            }
        });
        jScrollPane3.setViewportView(tbl1);

        jpanelC.setBackground(new java.awt.Color(204, 204, 204));
        jpanelC.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpanelC.setLayout(new java.awt.BorderLayout());

        jpanelD.setBackground(new java.awt.Color(204, 204, 204));
        jpanelD.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpanelD.setLayout(new java.awt.BorderLayout());

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btn_arbol2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btn_copiar2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(23, 23, 23))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(jpanelC, javax.swing.GroupLayout.PREFERRED_SIZE, 505, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 141, Short.MAX_VALUE)
                                .addComponent(jpanelD, javax.swing.GroupLayout.PREFERRED_SIZE, 526, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(btn_arbol2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(btn_copiar2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))))
                .addGap(32, 32, 32)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jpanelC, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jpanelD, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(35, 35, 35))
        );

        jPanel7.setBackground(new java.awt.Color(255, 255, 255));
        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Origen de la extracción y laminaridad en DT", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 14))); // NOI18N

        jLabel10.setText("Módulos laminares: A, B y C.");

        jButton4.setBackground(new java.awt.Color(204, 255, 0));
        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/lentes.png"))); // NOI18N
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        tbl7.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl7.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "ORIGEN DE LA EXT.", "LAMINAR", "NO LAMINAR", "%"
            }
        ));
        tbl7.setRowHeight(25);
        tbl7.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl7MouseClicked(evt);
            }
        });
        jScrollPane12.setViewportView(tbl7);

        jpanelE.setBackground(new java.awt.Color(204, 204, 204));
        jpanelE.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpanelE.setLayout(new java.awt.BorderLayout());

        jpanelF.setBackground(new java.awt.Color(204, 204, 204));
        jpanelF.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpanelF.setLayout(new java.awt.BorderLayout());

        btn_copiar5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/copiar.png"))); // NOI18N
        btn_copiar5.setToolTipText("Copiar valores en el portapapeles");
        btn_copiar5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_copiar5ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addComponent(jpanelE, javax.swing.GroupLayout.PREFERRED_SIZE, 502, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 143, Short.MAX_VALUE)
                        .addComponent(jpanelF, javax.swing.GroupLayout.PREFERRED_SIZE, 537, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btn_copiar5, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jScrollPane12))
                        .addContainerGap())))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(btn_copiar5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(31, 31, 31)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jpanelE, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jpanelF, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(42, Short.MAX_VALUE))
        );

        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.TRAILING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbx_mp, javax.swing.GroupLayout.PREFERRED_SIZE, 715, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                        .addGap(19, 19, 19)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(btn_calcular, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel15))
                            .addComponent(jLabel27))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(txt_muestra)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel16)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txt_sentencia, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(txt_mp_selec))))
                .addContainerGap(169, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(13, 13, 13))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(cbx_mp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton3))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_calcular, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel15)
                        .addComponent(txt_sentencia, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel16)
                        .addComponent(txt_muestra, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txt_mp_selec, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel27))
                .addGap(36, 36, 36)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(41, 41, 41)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(37, 37, 37)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(244, Short.MAX_VALUE))
        );

        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, 1246, Short.MAX_VALUE)
                .addGap(0, 0, 0))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 3740, Short.MAX_VALUE)
                .addGap(0, 0, 0))
        );

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

    private void tblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblMouseClicked
        int filaselec = tbl.getSelectedRow();
        int filas = tbl.getRowCount()-1;
        
        if(filaselec<filas){
             

            
        Graficos graf = new Graficos();
        graf.generargraficofila2(tbl, jpanelA, tbl.getValueAt(filaselec,0).toString(), "Tamaños");
            
         }
        
        int col=tbl.getColumnCount()-1;
        int columnaselec = tbl.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
             
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl, jpanelB, tbl.getColumnName(columnaselec), "Clases técnicas");
            
        }

    }//GEN-LAST:event_tblMouseClicked

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        if(WHERE.equals("")){
            JOptionPane.showMessageDialog(null, "Debe seleccionar una muestra previamente");
        }else{
            CalculosBD calc = new CalculosBD();
            calc.cargarmpFORM_DT(cbx_mp, WHERE);
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void btn_calcularComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_btn_calcularComponentHidden
        // TODO add your handling code here:
    }//GEN-LAST:event_btn_calcularComponentHidden

    private void btn_calcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_calcularActionPerformed
    if(WHERE.equals("")){
            JOptionPane.showMessageDialog(null, "Seleccione previamente una muestra");
        }else{
            if((cbx_mp.getSelectedIndex()==0)|| (cbx_mp.getItemCount()==0)){
                JOptionPane.showMessageDialog(null, "Seleccione previamente una materia prima");
            }else{
                 txt_muestra.setText(etiqueta_muestra);
                txt_sentencia.setText(WHERE);
                txt_mp_selec.setText(cbx_mp.getSelectedItem().toString());
                clasestecnicas();
                activarbotones(true);
                clasestecnicasEstandaryPuntas(" SEGMENTAL_ESTANDAR2 n ", tbl_clasetec_estandar);
                clasestecnicasEstandaryPuntas(" PUNTAS_DE_PROYECTIL2 n ", tbl_clasetec_punta);
            }
            }

    }//GEN-LAST:event_btn_calcularActionPerformed
private void clasestecnicas(){
    
         CalculosBD calculos = new CalculosBD();
      

String ids=calculos.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
        
 

    cbx_clasetecnica.removeAllItems();
    cbx_clasetecnica.addItem("Clases técnicas presentes en la muestra");
    
     ResultSet rs = null; 
     String consulta= "SELECT DISTINCT(f.CLASE_TECNICA) from FORMATIZADOS f \n" 

+ txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')" +ids ;
//    System.out.println("clase tecnica : " + consulta);


         try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                cbx_clasetecnica.addItem(rs.getString("CLASE_TECNICA"));
         
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
  
    
    
    
}
private void clasestecnicasEstandaryPuntas(String innerjoin, JTable tbl){
    
      CalculosBD calculos = new CalculosBD();
      calculos.LIMPIARTABLA(tbl);
      DefaultTableModel dtm = (DefaultTableModel) tbl.getModel();
      
String ids=calculos.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
        
 Object [] fila = new Object[1];


    
     ResultSet rs = null; 
     String consulta= "SELECT DISTINCT(f.CLASE_TECNICA) from FORMATIZADOS f \n"
              +  "INNER JOIN \n" +
innerjoin +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " 

+ txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')" +ids ;



         try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[0]=(rs.getString("CLASE_TECNICA"));
                dtm.addRow(fila);
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
  
    
    
    
}
    private void btn_infoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_infoActionPerformed
        info_frame info = new info_frame();
        info.setVisible(true);
        info.info_procedencia.setText("MUESTRA---->" + txt_muestra.getText() +"\n SENTENCIA---->" +txt_sentencia.getText() );
        info.info_mp.setText(txt_mp_selec.getText());
        info.info_analisis.setText(""
                + ""
                + "En las primeras dos tablas encontrará las clases técnicas asociadas a: fichas segmentales estándar y a puntas de proyectil.\n" +
"\n" +
"Luego, seleccione una clase técnica y efectúe el cálculo, ya sea para segmentales estándar o para puntas de proyectil. \n" +
"\n" +
"Sobre el cuadro se distribuiran todos los procedimientos técnicos de formatización de las fichas seleccionadas. \n" +
"\n" +
"\n" +
"Índices:\n" +
"-N° total de útiles: corresponde al total de la muestra seleccionada, y a la materia prima correspondiente. \n" +
"\n" +
"-Cantidad de piezas analizadas: corresponde a las piezas contabilizadas en la tabla. En este caso hablamos de piezas y no de fichas.\n" +
"\n" +
"-Cantidad de piezas no bipolares: contabiliza sobre la tabla el número de piezas en donde está seleccionada la opción \"TENBp-Talla de extracción no bipolar\" entre los procedimientos técnicos de formatización.\n" +
"\n" +
"-Cantidad de piezas bipolares: contabiliza sobre la tabla el número de piezas en donde está seleccionada al menos una de las siguientes opciones: \n" +
"\n" +
"---Lascas bipolar (forma base)\n" +
"---Nodulo con talla bipolar (forma base)\n" +
"--------TBp-Talla Bipolar (proc. tec. form.)\n" +
"--------RtBp-Retalla bipolar (proc. tec. form.)\n" +
"--------TERqBp-Talla de extracción + retoque bipolar (proc. tec. form.)");
    }//GEN-LAST:event_btn_infoActionPerformed

    private void btn_arbolActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_arbolActionPerformed
//        Arbol ar = new Arbol();
//        ar.setVisible(true);
////        arboltbl(txt_sentencia.getText(), txt_mp_selec.getText(),ar.arbol_analisis_FORM);
//
//        ar.txt_nota.setText("El árbol de Formatizados se conforma de acuerdo a clases artefactuales presentes en la materia prima seleccionada dentro de la muestra. En este caso, no se discrimina según módulos. El árbol de DT se agrupa según el tamaño de las piezas correspondientes a la MP seleccionada dentro de la muestra.");
    }//GEN-LAST:event_btn_arbolActionPerformed

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

                Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl2, txt_muestra.getText(), WHERE, 
                        "Técnicas de formatización sobre útiles"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiarActionPerformed

    private void btn_arbol1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_arbol1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btn_arbol1ActionPerformed

    private void btn_copiar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar1ActionPerformed
                Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl, txt_muestra.getText(), WHERE, 
                        "Tamaños por clase técnica"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar1ActionPerformed

    private void btn_arbol2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_arbol2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btn_arbol2ActionPerformed

    private void btn_copiar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar2ActionPerformed
                 Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl1, txt_muestra.getText(), WHERE, 
                        "Origen de la extracción y laminaridad en útiles"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar2ActionPerformed

    private void btn_info3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_info3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btn_info3ActionPerformed

    private void btn_arbol3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_arbol3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btn_arbol3ActionPerformed

    private void btn_copiar3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar3ActionPerformed
                         Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl_origenextrac_DT, txt_muestra.getText(), WHERE, 
                        "Compatibilidad en clases técnicas de útiles y origen de la extracción en DT"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar3ActionPerformed

    private void btn_info4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_info4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btn_info4ActionPerformed

    private void btn_arbol4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_arbol4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btn_arbol4ActionPerformed

    private void btn_copiar4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar4ActionPerformed
                            Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl3, txt_muestra.getText(), WHERE, 
                        "Compatibilidad procedim. tec. form. utiles y anchos talones en DT"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar4ActionPerformed
private void calcularultimatabla(){
    String opcion = cbx_compatible_tecnica.getSelectedItem().toString();

if(opcion.equals("Compatible con retalla")){
            contarutiltecnica(" AND ((n.RETALLA='true') OR (n.RETALLA_BIPOLAR='true')) ", " AND (n.RETALLA='true') ");
        contarDTrango1("1- (<2mm)");
}
if(opcion.equals("Compatible con retoque")){
            contarutiltecnica(" AND ((n.RETOQUE='true') OR (n.TALLA_EXTRACCION='true')) ", "AND (n.RETOQUE='true') ");
        contarDTrango1("2- (2-7mm)");
}
if(opcion.equals("Compatible con microrretoque")){
            contarutiltecnica(" AND (n.MICRORRETOQUE='true') ", "AND (n.MICRORRETOQUE='true')");
        contarDTrango1("3- (>7mm)");
}

        
   cantidaddeutiles();
   cantidaddeDTCT();
   
}
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
  CalculosBD calculos = new CalculosBD();
         
JTable tbl_aux2 = new javax.swing.JTable();

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

            },
            new String [] {
                "1", "2"
            }
        ));  
    
   DefaultTableModel dm = (DefaultTableModel) tbl_aux2.getModel();    
  
 ResultSet rs = null; 
     String consulta= "SELECT f.CLASE_TECNICA, f.TAMAÑO from FORMATIZADOS f \n" 

+ txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')" ;

String []fila = new String[2];

         try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[0] = rs.getString("CLASE_TECNICA");
                fila[1] = rs.getString("TAMAÑO");
                dm.addRow(fila);
        
                
                
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
   
        calculos.TABLA_FRECUENCIAS_DOS_VALORES("CLASE TECNICA", tbl_aux2, tbl);

        
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
     CalculosBD calculos = new CalculosBD();
      

String ids=calculos.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
        
          
JTable tbl_aux2 = new javax.swing.JTable();

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

            },
            new String [] {
                "1", "2"
            }
        ));  
    
   DefaultTableModel dm = (DefaultTableModel) tbl_aux2.getModel();    
  
 ResultSet rs = null; 
     String consulta= "SELECT f.ORIGEN_EXTRAC, f.MODULO_LONG_ANCHO from FORMATIZADOS f \n" 

+ txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') " +ids ;

String []fila = new String[2];

         try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[0] = rs.getString("ORIGEN_EXTRAC");
                String modulo = rs.getString("MODULO_LONG_ANCHO");
                if((modulo.equals("A"))||(modulo.equals("B"))||(modulo.equals("C"))){
                 fila[1]="LAMINAR";   
                }else{
                    if(modulo.equals("CN")){
                    fila[1]="CN";                        
                    }else{
                    fila[1]="NO LAMINAR";                        
                    }

                }
                 
                 dm.addRow(fila);
        
                
                
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
   
        calculos.TABLA_FRECUENCIAS_DOS_VALORES("ORIGEN DE LA EXTRAC.", tbl_aux2, tbl1);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void tbl1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl1MouseClicked
        int filaselec = tbl1.getSelectedRow();
        int filas = tbl1.getRowCount()-1;
        
        if(filaselec<filas){
             

            
        Graficos graf = new Graficos();
        graf.generargraficofila2(tbl1, jpanelC, tbl1.getValueAt(filaselec,0).toString(), "Laminaridad");
            
         }
        
        int col=tbl1.getColumnCount()-1;
        int columnaselec = tbl1.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
             
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl1, jpanelD, tbl1.getColumnName(columnaselec), "Origen extrac.");
            
        }
    }//GEN-LAST:event_tbl1MouseClicked

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
     CalculosBD calculos = new CalculosBD();
      


JTable tbl_aux2 = new javax.swing.JTable();

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

            },
            new String [] {
                "1", "2"
            }
        ));  
    
   DefaultTableModel dm = (DefaultTableModel) tbl_aux2.getModel();    
  
 ResultSet rs = null; 
     String consulta= "SELECT f.ORIGEN_EXTRACCION, f.MODULO_LONG_ANCHO from DT_CONTALON2 f \n" 

+ txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') " ;

String []fila = new String[2];

         try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[0] = rs.getString("ORIGEN_EXTRACCION");
                String modulo = rs.getString("MODULO_LONG_ANCHO");
                if((modulo.equals("A"))||(modulo.equals("B"))||(modulo.equals("C"))){
                 fila[1]="LAMINAR";   
                }else{
                    if(modulo.equals("CN")){
                    fila[1]="CN";                        
                    }else{
                    fila[1]="NO LAMINAR";                        
                    }

                }
                 
                 dm.addRow(fila);
        
                
                
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
   
        calculos.TABLA_FRECUENCIAS_DOS_VALORES("ORIGEN DE LA EXTRAC.", tbl_aux2, tbl7);
    }//GEN-LAST:event_jButton4ActionPerformed

    private void tbl7MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl7MouseClicked
         int filaselec = tbl7.getSelectedRow();
        int filas = tbl7.getRowCount()-1;
        
        if(filaselec<filas){
             

            
        Graficos graf = new Graficos();
        graf.generargraficofila2(tbl7, jpanelE, tbl7.getValueAt(filaselec,0).toString(), "Laminaridad");
            
         }
        
        int col=tbl7.getColumnCount()-1;
        int columnaselec = tbl7.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
             
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl7, jpanelF, tbl7.getColumnName(columnaselec), "Origen extrac.");
            
        }
    }//GEN-LAST:event_tbl7MouseClicked

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
      calcularultimatabla();
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
  obtenertecnicassegmentales();
  calculosprimercuadro();
    }//GEN-LAST:event_jButton6ActionPerformed
    private void calculosprimercuadro(){

txt1_n_utiles.setText(title);
        CalculosBD calc=new CalculosBD();
String ids=calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
ResultSet rs = null; 
int cantutiles=0;
     String consulta = "SELECT COUNT(*) FROM FORMATIZADOS f \n"
            + txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')" + ids;
//     System.out.println("consulta:" +consulta);
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            if(rs.next()){
                cantutiles=(rs.getInt("1"));
                txt1_n_utiles.setText(String.valueOf(cantutiles));
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
     int cantutilescompatibles = cantidaddepiezas();
     txt1_piezas_analizadas.setText(String.valueOf(cantutilescompatibles));
     
    
     float porcentaje = calc.porcentajeCIENPORCIENTO(txt1_piezas_analizadas.getText(), txt1_n_utiles.getText());
     txt1_piezas_sobreutiles.setText(String.valueOf(porcentaje));
     
     


     obtenertallasnobip(tbl2, 3,  txt1_piezasnobip);
     porcentaje = calc.porcentajeCIENPORCIENTO(txt1_piezasnobip.getText(), txt1_n_utiles.getText());
     txt1_porc_nobip.setText(String.valueOf(porcentaje));
     
     obtenertallasbip(tbl2, 4, 5, 9, 10,  txt1_cant_bipolar);
     porcentaje = calc.porcentajeCIENPORCIENTO(txt1_cant_bipolar.getText(), txt1_n_utiles.getText());
     txt1_porc_Bipo.setText(String.valueOf(porcentaje));
     

     
}
    private void obtenertallasnobip(JTable tbl, int col, JTextField txt){
               ArrayList<Object> piezas = new ArrayList<>();
    
    String par="";
    String celda="";
        for (int i = 0; i < tbl2.getRowCount(); i++) {
            if(tbl2.getValueAt(i, col).toString().equals("Sí")){
            par = tbl2.getValueAt(i, 0).toString()+tbl2.getValueAt(i, col).toString();
            piezas.add(par);
                
            }
            
        }
        
        
        Set<Object> hashSet = new HashSet<Object>(piezas);
        piezas.clear();
        piezas.addAll(hashSet); 

        txt.setText(String.valueOf(piezas.size()));
        
    }
    private int cantidaddepiezas(){

       ArrayList<Object> piezas = new ArrayList<>();
       
        for (int i = 0; i < tbl2.getRowCount(); i++) {
            piezas.add(tbl2.getValueAt(i, 0));
            
        }
        
        
        Set<Object> hashSet = new HashSet<Object>(piezas);
        piezas.clear();
        piezas.addAll(hashSet);     


return piezas.size();
        
    }
    private void obtenertallasbip(JTable tbl, int col1, int col2, int col3, int col4, JTextField txt){
               ArrayList<Object> piezas = new ArrayList<>();
    
    String par="";
    String celda="";
        for (int i = 0; i < tbl2.getRowCount(); i++) {
            if((tbl2.getValueAt(i, col1).toString().equals("Sí"))||(tbl2.getValueAt(i, col2).toString().equals("Sí"))
             ||(tbl2.getValueAt(i, col3).toString().equals("Sí"))||(tbl2.getValueAt(i, col4).toString().equals("Sí") )){
            par = tbl2.getValueAt(i, 0).toString();
            piezas.add(par);
                
            }
            
        }
        
        
        Set<Object> hashSet = new HashSet<Object>(piezas);
        piezas.clear();
        piezas.addAll(hashSet); 

        txt.setText(String.valueOf(piezas.size()));
        
    }
//    private int cantidaddepiezas(){
//
//       ArrayList<Object> piezas = new ArrayList<>();
//       
//        for (int i = 0; i < tbl2.getRowCount(); i++) {
//            piezas.add(tbl2.getValueAt(i, 0));
//            
//        }
//        
//        
//        Set<Object> hashSet = new HashSet<Object>(piezas);
//        piezas.clear();
//        piezas.addAll(hashSet);     
//
//
//return piezas.size();
//        
//    }
    private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened
activarbotones(false);
    }//GEN-LAST:event_formInternalFrameOpened

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
  obtenertecnicaspuntas();
  calculosprimercuadro();
    }//GEN-LAST:event_jButton9ActionPerformed

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

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

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

    private void txt1_piezasnobipActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt1_piezasnobipActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txt1_piezasnobipActionPerformed

    private void BTN_REDUC_ADEL_UNIBIFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BTN_REDUC_ADEL_UNIBIFActionPerformed
    calcularclasestecnicasutiles(" AND ((f.CLASE_TECNICA='AAB-Artefactos con adelgazamiento bifacial') OR (f.CLASE_TECNICA='ARB-Con reducción bifacial') OR (f.CLASE_TECNICA='AUf-Adelgazamiento unifacial') OR (f.CLASE_TECNICA='RUf-Reducción unifacial') ) ");
    calcularorigenextdt(" AND (f.ORIGEN_EXTRACCION='1-Adelg/Reduc bifacial') ");
    }//GEN-LAST:event_BTN_REDUC_ADEL_UNIBIFActionPerformed

    private void btn_marginalunibiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_marginalunibiActionPerformed
    calcularclasestecnicasutiles(" AND ((f.CLASE_TECNICA='BMg-Bifaciales-marginales') OR (f.CLASE_TECNICA='UfMg-Unifaciales marginales') OR (f.CLASE_TECNICA='TEsF-Talla de extracción sin formatización') ) ");
    calcularorigenextdt(" AND ((f.ORIGEN_EXTRACCION='2-React. Direc. Filos') OR (f.ORIGEN_EXTRACCION='3-React Invers. Filos')  OR (f.ORIGEN_EXTRACCION='4-React plataf.')  OR (f.ORIGEN_EXTRACCION='5-Reac frent extrac')  )  ");
    }//GEN-LAST:event_btn_marginalunibiActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
      JOptionPane.showMessageDialog(null, "Tome en cuenta que el recuento total de útiles se efectúa sobre todas las clases técnicas");
    }//GEN-LAST:event_jButton7ActionPerformed

    private void btn_copiar5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar5ActionPerformed
                      Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl7, txt_muestra.getText(), WHERE, 
                        "Origen de la extracción y laminaridad en DT"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar5ActionPerformed

    private void btn_copiar6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar6ActionPerformed
                         Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl_clasetecnica_utiles, txt_muestra.getText(), WHERE, 
                        "Compatibilidad en clases técnicas de útiles y origen de la extracción en DT"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar6ActionPerformed

    private void btn_copiar7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar7ActionPerformed
                                Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl4, txt_muestra.getText(), WHERE, 
                        "Compatibilidad procedim. tec. form. utiles y anchos talones en DT"
                        , "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar7ActionPerformed

    private void calcularorigenextdt(String origenext){

        
        CalculosBD calc = new CalculosBD();
        calc.LIMPIARTABLA(tbl_origenextrac_DT);
 
        DefaultTableModel dtm = (DefaultTableModel) tbl_origenextrac_DT.getModel();
           
                
    ResultSet rs = null; 
    
Object [] fila = new Object[3];
fila[0]="0";
fila[1]="0";
fila[2]="0";

        
         String consulta = "SELECT  COUNT(f.ORIGEN_EXTRACCION), f.ORIGEN_EXTRACCION  from DT_CONTALON2 f  \n" 
+ txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') " +origenext +" GROUP BY f.ORIGEN_EXTRACCION ";       
        
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                if(rs.getInt("1")>0){
                fila[1]=rs.getInt("1");
                fila[0]=rs.getString("ORIGEN_EXTRACCION");
                dtm.addRow(fila); 
                }

            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
            
                
calc.sumartotalesfila(dtm);
calc.sumartotalescolumna(dtm);
calc.porcentajesfilainferior(dtm);          
                
                
                
        
        
    }
    private void calcularclasestecnicasutiles(String clasetecnica){

        
        CalculosBD calc = new CalculosBD();
        calc.LIMPIARTABLA(tbl_clasetecnica_utiles);
        String ids = calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
        DefaultTableModel dtm = (DefaultTableModel) tbl_clasetecnica_utiles.getModel();
           
                
    ResultSet rs = null; 
    
Object [] fila = new Object[3];
fila[0]="0";
fila[1]="0";
fila[2]="0";

        
         String consulta = "SELECT  COUNT(f.CLASE_TECNICA), f.CLASE_TECNICA  from FORMATIZADOS f  \n" 
+ txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') " +clasetecnica + ids +" GROUP BY f.CLASE_TECNICA ";       
//        
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[1]=rs.getInt("1");
                fila[0]=rs.getString("CLASE_TECNICA");
           
                dtm.addRow(fila);
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
            
                
 calc.sumartotalesfila(dtm);
calc.sumartotalescolumna(dtm);
calc.porcentajesfilainferior(dtm);               
                
                
                
        
        
    }
    
    
    
    
    private void activarbotones(Boolean activar){
if(activar==true){
    jButton5.setEnabled(true);
BTN_REDUC_ADEL_UNIBIF.setEnabled(true);
jButton4.setEnabled(true);
jButton2.setEnabled(true);
jButton1.setEnabled(true);
jButton6.setEnabled(true);
jButton9.setEnabled(true);
btn_marginalunibi.setEnabled(true);
}else{
  jButton5.setEnabled(false);
BTN_REDUC_ADEL_UNIBIF.setEnabled(false);
jButton4.setEnabled(false);
jButton2.setEnabled(false);
jButton1.setEnabled(false);
jButton6.setEnabled(false);  
jButton9.setEnabled(false);  
btn_marginalunibi.setEnabled(false);  
}

    
}
    private void obtenertecnicassegmentales(){
int nfilosPuntas= 0;

String filopunta="";
String clasetecnica = filtroclasetecnica();
CalculosBD calc = new CalculosBD();
calc.LIMPIARTABLA(tbl2);
DefaultTableModel dtm = (DefaultTableModel) tbl2.getModel();
ResultSet rs = null; 
    
Object [] fila = new Object[17];

        for (int i = 0; i < 17; i++) {
            fila[i]="0";
        }
        
        
        
 String  consulta = "SELECT f.ID_FORMATIZADOS, f.FORMA_BASE, n.ID_ESTANDAR, n.GRUPO, n.FILO_PUNTA_SUP, "
           + "n.TALLA_BIPOLAR, n.RETALLA_BIPOLAR, n.TALLA_EXTRACCION, "
           + "n.RETALLA, n.RETOQUE, n.MICRORRETOQUE, "
           + "n.PICADO, n.ALISADO, n.PULIDO, n.ABRASION, "
           + "n.TALLA_EXT_NOBIP, "
           + "n.NO_DIFERENCIADO, n.TEC_NO_PER "
           + "  FROM FORMATIZADOS f \n "
            +  "INNER JOIN \n" +
"SEGMENTAL_ESTANDAR2 n \n" +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " +
       txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') " + clasetecnica;
 
//        System.out.println("consulta; " + consulta);
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[0]=(rs.getInt("ID_FORMATIZADOS"));
                fila[1]=rs.getInt("ID_ESTANDAR");
                fila[2]=rs.getString("GRUPO");
                fila[3]=tecnicas_0_1(rs.getString("TALLA_EXT_NOBIP"));
                fila[4]=tecnicas_0_1(rs.getString("TALLA_BIPOLAR"));
                fila[5]=tecnicas_0_1(rs.getString("FORMA_BASE"));
                fila[6]=tecnicas_0_1(rs.getString("RETALLA"));
                fila[7]=tecnicas_0_1(rs.getString("RETOQUE"));
                fila[8]=tecnicas_0_1(rs.getString("MICRORRETOQUE"));
                fila[9]=tecnicas_0_1(rs.getString("RETALLA_BIPOLAR"));
                fila[10]=tecnicas_0_1(rs.getString("TALLA_EXTRACCION"));
                fila[11]=tecnicas_0_1(rs.getString("PICADO"));
                fila[12]=tecnicas_0_1(rs.getString("ALISADO"));
                fila[13]=tecnicas_0_1(rs.getString("PULIDO"));
                fila[14]=tecnicas_0_1(rs.getString("ABRASION"));
                fila[15]=tecnicas_0_1(rs.getString("NO_DIFERENCIADO"));
                fila[16]=tecnicas_0_1(rs.getString("TEC_NO_PER"));
                dtm.addRow(fila);
                filopunta=rs.getString("FILO_PUNTA_SUP");
                if((filopunta.equals("Filo"))||(filopunta.equals("Punta de mano"))){
                    nfilosPuntas=nfilosPuntas+1;
                }
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
txt_n_filospuntas.setText(String.valueOf(nfilosPuntas));

        
    }
   private String filtroclasetecnica(){
   String clasetecnica= "";
       if(cbx_clasetecnica.getSelectedIndex()>0){
        clasetecnica = " AND (f.CLASE_TECNICA='"+cbx_clasetecnica.getSelectedItem().toString()+"') ";
        txt_clasetecnica.setText(cbx_clasetecnica.getSelectedItem().toString());
    }else{
        txt_clasetecnica.setText("Todas las clases técnicas");   
       }
       return clasetecnica;
   } 
    private void obtenertecnicaspuntas(){
        String clasetecnica = filtroclasetecnica();
        
CalculosBD calc = new CalculosBD();
calc.LIMPIARTABLA(tbl2);
DefaultTableModel dtm = (DefaultTableModel) tbl2.getModel();
ResultSet rs = null; 
    
Object [] fila = new Object[17];

        for (int i = 0; i < 17; i++) {
            fila[i]="-";
        }
        
        
        
 String  consulta = "SELECT f.ID_FORMATIZADOS, f.FORMA_BASE, n.ID_PUNTAS, n.SUBGRUPO, "
           + "n.TALLA_EXT_NOBIP, "
           + "n.RETALLA, n.RETOQUE, n.MICRORRETOQUE, "
           + " n.PULIDO, n.ABRASION, "
           
           + "n.NO_DIFERENCIADO "
           + "  FROM FORMATIZADOS f \n "
            +  "INNER JOIN \n" +
"PUNTAS_DE_PROYECTIL2 n \n" +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " +
       txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') "  + clasetecnica;
 
//        System.out.println("consulta; " + consulta);
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[0]=(rs.getInt("ID_FORMATIZADOS"));
                fila[1]=rs.getInt("ID_PUNTAS");
                fila[2]=rs.getString("SUBGRUPO");
                fila[3]=tecnicas_0_1(rs.getString("TALLA_EXT_NOBIP"));
            
                fila[5]=tecnicas_0_1(rs.getString("FORMA_BASE"));
                fila[6]=tecnicas_0_1(rs.getString("RETALLA"));
                fila[7]=tecnicas_0_1(rs.getString("RETOQUE"));
                fila[8]=tecnicas_0_1(rs.getString("MICRORRETOQUE"));

                fila[13]=tecnicas_0_1(rs.getString("PULIDO"));
                fila[14]=tecnicas_0_1(rs.getString("ABRASION"));
                fila[15]=tecnicas_0_1(rs.getString("NO_DIFERENCIADO"));

                dtm.addRow(fila);
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     


        
    }
    
    private String tecnicas_0_1(String tecnica){
     String aux = "-";

        
        if(tecnica.equals("true")){
            aux="Sí";
        }
        if((tecnica.equals("NdTB-Nódulo con talla bipolar"))||(tecnica.equals("LsBp.Lasca bipolar (doble bulbo de percusión)"))){
            aux="Sí";
        }
        
        
        return aux;
    }
    private String tecnicas_0_1(){
     String aux = "nulo";

        
        return aux;
    }
    
    private void cantidaddeutiles(){
CalculosBD calc=new CalculosBD();

String ids=calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
ResultSet rs = null; 
int cantutiles=0;
     String consulta = "SELECT COUNT(*) FROM FORMATIZADOS f \n"
            + txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')" + ids;
//     System.out.println("consulta:" +consulta);
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            if(rs.next()){
                cantutiles=(rs.getInt("1"));
                txt_n_utiles.setText(String.valueOf(cantutiles));
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
     int cantutilescompatibles = tbl3.getRowCount();
     txt_utiles_en_tabla.setText(String.valueOf(cantutilescompatibles));
     
    
     float porcentaje = calc.porcentajeCIENPORCIENTO(txt_utiles_en_tabla.getText(), txt_n_utiles.getText());
     txt_porc_sobreutiles.setText(String.valueOf(porcentaje));
}
private void cantidaddeDTCT(){
  CalculosBD calc=new CalculosBD();
ResultSet rs = null; 
int cantDTCT=0;
     String consulta = "SELECT COUNT(*) FROM DT_CONTALON2 f \n"
            + txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')" ;

       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            if(rs.next()){
                cantDTCT=(rs.getInt("1"));
                txt_canDTCT.setText(String.valueOf(cantDTCT));
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
          int cantutilescompatibles = tbl4.getRowCount();
     txt_dt_en_tabla.setText(String.valueOf(cantutilescompatibles));
     
    
     float porcentaje = calc.porcentajeCIENPORCIENTO(txt_dt_en_tabla.getText(), txt_canDTCT.getText());
     txt_porc_sobre_DT.setText(String.valueOf(porcentaje));
}
private void contarDTrango1(String rango){
  CalculosBD calc=new CalculosBD();
ResultSet rs = null; 
calc.LIMPIARTABLA(tbl4);
DefaultTableModel dtm2 = (DefaultTableModel)tbl4.getModel();

Object [] fila = new Object[1];
int cantDTCT=0;
     String consulta = "SELECT f.ID_DT_CONTALON FROM DT_CONTALON2 f \n"
            + txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') AND (f.RANGO_ANCHO_TALON='"+rango+"')" ;

       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                fila[0]=rs.getInt("ID_DT_CONTALON");
             
                dtm2.addRow(fila);
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     

}
    
    private void contarutiltecnica(String tecnicasegmental, String tecnicapunta){
CalculosBD calc=new CalculosBD();
calc.LIMPIARTABLA(tbl3); 
String ids=calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
DefaultTableModel dtm1 = (DefaultTableModel) tbl3.getModel();
   
int id=0;
    String pieza="";
    
    Object valor = new Object();
        ArrayList<Object> lista = new ArrayList<>();
//        ArrayList<Integer> ids_para_tabla = new ArrayList<>();
    ResultSet rs = null; 
    String consulta = "SELECT DISTINCT(f.ID_FORMATIZADOS)  FROM FORMATIZADOS f \n"
            +  "INNER JOIN \n" +
"SEGMENTAL_ESTANDAR2 n \n" +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " +
       txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')"+ tecnicasegmental  + ids;
//        System.out.println("consulta: " + consulta);
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                valor=(rs.getInt("ID_FORMATIZADOS"));
                              
                lista.add(valor);
   

            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
     
     
   consulta = "SELECT DISTINCT(f.ID_FORMATIZADOS)  FROM FORMATIZADOS f \n"
            +  "INNER JOIN \n" +
"PUNTAS_DE_PROYECTIL2 n \n" +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " +
       txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"')"+ tecnicapunta  + ids;
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                id=(rs.getInt("ID_FORMATIZADOS"));

                valor=id;

                lista.add(valor);

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

        Set<Object> hashSet = new HashSet<Object>(lista);
        lista.clear();
        lista.addAll(hashSet);     


            Object[]fila2 = new Object[1];
for (int i = 0; i < lista.size(); i++) {
            fila2[0] = lista.get(i);
             dtm1.addRow(fila2);
        }
        
}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BTN_REDUC_ADEL_UNIBIF;
    private javax.swing.ButtonGroup botones1;
    private javax.swing.ButtonGroup botones2;
    private javax.swing.JButton btn_arbol;
    private javax.swing.JButton btn_arbol1;
    private javax.swing.JButton btn_arbol2;
    private javax.swing.JButton btn_arbol3;
    private javax.swing.JButton btn_arbol4;
    private javax.swing.JButton btn_calcular;
    private javax.swing.JButton btn_copiar;
    private javax.swing.JButton btn_copiar1;
    private javax.swing.JButton btn_copiar2;
    private javax.swing.JButton btn_copiar3;
    private javax.swing.JButton btn_copiar4;
    private javax.swing.JButton btn_copiar5;
    private javax.swing.JButton btn_copiar6;
    private javax.swing.JButton btn_copiar7;
    private javax.swing.JButton btn_info;
    private javax.swing.JButton btn_info3;
    private javax.swing.JButton btn_info4;
    private javax.swing.JButton btn_marginalunibi;
    private javax.swing.JComboBox<String> cbx_clasetecnica;
    private javax.swing.JComboBox<String> cbx_compatible_tecnica;
    private javax.swing.JComboBox<String> cbx_mp;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton9;
    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 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 jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane14;
    private javax.swing.JScrollPane jScrollPane15;
    private javax.swing.JScrollPane jScrollPane16;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JTextArea jTextArea3;
    private javax.swing.JTextArea jTextArea4;
    private javax.swing.JPanel jpanelA;
    private javax.swing.JPanel jpanelB;
    private javax.swing.JPanel jpanelC;
    private javax.swing.JPanel jpanelD;
    private javax.swing.JPanel jpanelE;
    private javax.swing.JPanel jpanelF;
    private javax.swing.JTable tbl;
    private javax.swing.JTable tbl1;
    private javax.swing.JTable tbl2;
    private javax.swing.JTable tbl3;
    private javax.swing.JTable tbl4;
    private javax.swing.JTable tbl7;
    private javax.swing.JTable tbl_clasetec_estandar;
    private javax.swing.JTable tbl_clasetec_punta;
    private javax.swing.JTable tbl_clasetecnica_utiles;
    private javax.swing.JTable tbl_origenextrac_DT;
    private javax.swing.JTextField txt1_cant_bipolar;
    private javax.swing.JTextField txt1_n_utiles;
    private javax.swing.JTextField txt1_piezas_analizadas;
    private javax.swing.JTextField txt1_piezas_sobreutiles;
    private javax.swing.JTextField txt1_piezasnobip;
    private javax.swing.JTextField txt1_porc_Bipo;
    private javax.swing.JTextField txt1_porc_nobip;
    private javax.swing.JTextField txt_canDTCT;
    private javax.swing.JTextField txt_clasetecnica;
    private javax.swing.JTextField txt_dt_en_tabla;
    private javax.swing.JTextField txt_mp_selec;
    private javax.swing.JTextField txt_muestra;
    private javax.swing.JTextField txt_n_filospuntas;
    private javax.swing.JTextField txt_n_utiles;
    private javax.swing.JTextField txt_porc_sobre_DT;
    private javax.swing.JTextField txt_porc_sobreutiles;
    private javax.swing.JTextField txt_sentencia;
    private javax.swing.JTextField txt_utiles_en_tabla;
    // End of variables declaration//GEN-END:variables
}
