/*
 * 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 arql2020.ARQL2020;
import static arql2020.ARQL2020.WHERE;
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.Locale;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTree;
import javax.swing.table.DefaultTableModel;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
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 E_Talla_de_extraccion2 extends javax.swing.JInternalFrame {


       String  lascasutiles = " AND (f.FORMA_BASE IN( 'LsP-Lasca primaria o cortical', \n" +
            "'LsS-Lasca secundaria o de descortezamiento',\n" +
            "'LsDN-Lasca con dorso natural(gajo)' ,\n" +
            "'LsAng-Lasca angular' ,\n" +
            "'LsAr-Lasca de arista' ,\n" +
            "'LsPl-Lasca plana' ,\n" +
            "'LsCta-Lasca en cresta' ,\n" +
            "'LsFNu-Lasca de flanco de núcleo' ,\n" +
            "'LsTNu-Lasca de tableta de núcleo' ,\n" +
            "'LsST-Lasca de semitableta de núcleo' ,\n" +
            "'LsBp.Lasca bipolar (doble bulbo de percusión)' ,\n" +
            "'LsND-Lasca no diferenciada' ,\n" +
            "'LsRc-Lasca reciclada' ))   ";
            
            
    String hojasutiles = "AND (f.FORMA_BASE='HoArS-Hoja de arista simple' OR "
                            + "f.FORMA_BASE='HoArM-Hoja de arista doble o múltiple' OR "
                            + "f.FORMA_BASE='HoND-Hoja no diferenciada' OR "
                            + "f.FORMA_BASE='HoRc-Hoja reciclada'  "

                             + ") ";
    
    String lascasDT = " AND (f.FORMA_BASE IN( 'LsP-Lasca primaria o cortical', \n" +
            "'LsS-Lasca secundaria o de descortezamiento',\n" +
            "'LsDN-Lasca con dorso natural(gajo)' ,\n" +
            "'LsAng-Lasca angular' ,\n" +
            "'LsAr-Lasca de arista' ,\n" +
            "'LsPl-Lasca plana' ,\n" +
            "'LsCta-Lasca en cresta' ,\n" +
            "'LsFNu-Lasca de flanco de núcleo' ,\n" +
            "'LsTNu-Lasca de tableta de núcleo' ,\n" +
            "'LsST-Lasca de semitableta de núcleo' ,\n" +
            "'LsBp.Lasca bipolar (doble bulbo de percusión)' ,\n" +
            "'LsND-Lasca no diferenciada' ))   ";
    
        String hojasdt = "AND (f.FORMA_BASE='HoArS-Hoja de arista simple' OR "
                            + "f.FORMA_BASE='HoArM-Hoja de arista doble o múltiple' OR "
                            + "f.FORMA_BASE='HoND-Hoja no diferenciada'  "
                                                    + ") ";
        
    public E_Talla_de_extraccion2() {
        initComponents();
            try {
            this.setMaximum(true);
        } catch (PropertyVetoException ex) {
            Logger.getLogger(B_Composicion_puntasfilossup.class.getName()).log(Level.SEVERE, null, ex);
        }
            
 
       botones3.add(fila2);     
       botones3.add(columna2);     
        
       botones1.add(fila);     
       botones1.add(columna);     

       botones2.add(fila8);     
       botones2.add(columna8);  
       
       botones4.add(fila3);
       botones4.add(columna3);
    }

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

        botones2 = new javax.swing.ButtonGroup();
        botones3 = new javax.swing.ButtonGroup();
        botones1 = new javax.swing.ButtonGroup();
        botones4 = new javax.swing.ButtonGroup();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        tbl = new javax.swing.JTable();
        fila = new javax.swing.JRadioButton();
        columna = new javax.swing.JRadioButton();
        jpanel = new javax.swing.JPanel();
        btn_info = new javax.swing.JButton();
        btn_arbol = new javax.swing.JButton();
        btn_copiar = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tbl2 = new javax.swing.JTable();
        jLabel17 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tbl3 = new javax.swing.JTable();
        jLabel12 = new javax.swing.JLabel();
        txt_indice_corticalidad_utiles = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        txt_indice_cor_DT = new javax.swing.JTextField();
        fila2 = new javax.swing.JRadioButton();
        columna2 = new javax.swing.JRadioButton();
        jpanel1 = new javax.swing.JPanel();
        jpanel2 = new javax.swing.JPanel();
        btn_copiar1 = new javax.swing.JButton();
        btn_info1 = new javax.swing.JButton();
        btn_arbol1 = new javax.swing.JButton();
        jScrollPane12 = new javax.swing.JScrollPane();
        tbl8 = new javax.swing.JTable();
        jLabel7 = new javax.swing.JLabel();
        jpanel10 = new javax.swing.JPanel();
        jScrollPane13 = new javax.swing.JScrollPane();
        tbl9 = new javax.swing.JTable();
        jpanel11 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        txt_n_utiles = new javax.swing.JTextField();
        jLabel28 = new javax.swing.JLabel();
        jLabel29 = new javax.swing.JLabel();
        txt_n_lsprimsec = new javax.swing.JTextField();
        txt_DT_lsext = new javax.swing.JTextField();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        txt_n_dt = new javax.swing.JTextField();
        fila8 = new javax.swing.JRadioButton();
        columna8 = new javax.swing.JRadioButton();
        btn_copiar4 = new javax.swing.JButton();
        btn_copiar5 = new javax.swing.JButton();
        btn_copiar6 = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tbl4 = new javax.swing.JTable();
        fila3 = new javax.swing.JRadioButton();
        columna3 = new javax.swing.JRadioButton();
        jpanel3 = new javax.swing.JPanel();
        btn_info2 = new javax.swing.JButton();
        btn_arbol2 = new javax.swing.JButton();
        btn_copiar2 = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jLabel34 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        txt_n_hojasenutiles = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        txt_n_lascasenutiles = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jpanel4 = new javax.swing.JPanel();
        txt_n_hojasendt = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        txt_n_lascasendt = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        btn_info3 = new javax.swing.JButton();
        btn_copiar3 = new javax.swing.JButton();
        jLabel32 = new javax.swing.JLabel();
        txt_porc_lascasDT = new javax.swing.JTextField();
        txt_porc_hojasDT = new javax.swing.JTextField();
        jLabel33 = new javax.swing.JLabel();
        txt_porc_lascasUtiles = new javax.swing.JTextField();
        jLabel35 = new javax.swing.JLabel();
        txt_porc_hojasUtiles = new javax.swing.JTextField();
        jLabel36 = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        txt_n_utiles2 = new javax.swing.JTextField();
        jLabel37 = new javax.swing.JLabel();
        txt_n_dt2 = new javax.swing.JTextField();
        jLabel38 = new javax.swing.JLabel();
        txt_n_nucleosagotados = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        cbx_mp = new javax.swing.JComboBox<>();
        btn_calcular = new javax.swing.JButton();
        txt_sentencia = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel27 = new javax.swing.JLabel();
        txt_muestra = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        txt_mp_selec = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jInternalFrame1 = new javax.swing.JInternalFrame();
        jScrollPane3 = new javax.swing.JScrollPane();
        jPanel6 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane9 = new javax.swing.JScrollPane();
        tbl1 = new javax.swing.JTable();
        fila4 = new javax.swing.JRadioButton();
        columna4 = new javax.swing.JRadioButton();
        jpanel5 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        tbl5 = new javax.swing.JTable();
        jLabel21 = new javax.swing.JLabel();
        jScrollPane10 = new javax.swing.JScrollPane();
        tbl6 = new javax.swing.JTable();
        jLabel13 = new javax.swing.JLabel();
        jTextField8 = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        jTextField9 = new javax.swing.JTextField();
        fila5 = new javax.swing.JRadioButton();
        columna5 = new javax.swing.JRadioButton();
        fila6 = new javax.swing.JRadioButton();
        columna6 = new javax.swing.JRadioButton();
        jpanel6 = new javax.swing.JPanel();
        jpanel7 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane11 = new javax.swing.JScrollPane();
        tbl7 = new javax.swing.JTable();
        fila7 = new javax.swing.JRadioButton();
        columna7 = new javax.swing.JRadioButton();
        jpanel8 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jTextField14 = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jTextField15 = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jTextField16 = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        jpanel9 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jComboBox2 = new javax.swing.JComboBox<>();

        setClosable(true);
        setMaximizable(true);
        setResizable(true);
        setTitle("Talla de extracción");
        setToolTipText("");
        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, "Forma de la plataforma en núcleos y en el talón de útiles", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 16))); // NOI18N

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

            },
            new String [] {
                "FORMA", "TALON UTILES", "PLAT NUCLEOS", "TOTAL"
            }
        ));
        tbl.setGridColor(new java.awt.Color(255, 102, 102));
        tbl.setRowHeight(25);
        tbl.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblMouseClicked(evt);
            }
        });
        jScrollPane6.setViewportView(tbl);

        fila.setBackground(new java.awt.Color(255, 204, 204));
        fila.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila.setText("Ordenar por fila");

        columna.setBackground(new java.awt.Color(255, 204, 204));
        columna.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna.setText("Ordenar por columna");

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

        btn_info.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/info.png"))); // NOI18N
        btn_info.setToolTipText("Información sobre el análisis");
        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);
            }
        });

        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)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 522, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .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)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 236, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(fila)
                        .addGap(18, 18, 18)
                        .addComponent(columna))
                    .addComponent(jpanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 525, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fila)
                            .addComponent(columna))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jpanel, javax.swing.GroupLayout.PREFERRED_SIZE, 271, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel2Layout.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(21, 21, 21)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 267, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(20, 20, 20))
        );

        jPanel3.setBackground(new java.awt.Color(204, 204, 255));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Corticalidad en útiles y en desechos de talla", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 16))); // NOI18N

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel5.setText("Tabla 2. Proporción de corteza en útiles");

        tbl2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"1", "", "", ""},
                {"2", "", "", ""},
                {"3", "", "", ""},
                {"4", "", "", ""}
            },
            new String [] {
                "TAMAÑO", "LS PRIMARIAS", "LS SECUNDARIAS", "TOTAL"
            }
        ));
        tbl2.setGridColor(new java.awt.Color(255, 102, 102));
        tbl2.setRowHeight(25);
        tbl2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl2MouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tbl2);
        if (tbl2.getColumnModel().getColumnCount() > 0) {
            tbl2.getColumnModel().getColumn(0).setHeaderValue("TAMAÑO");
            tbl2.getColumnModel().getColumn(1).setHeaderValue("LS PRIMARIAS");
            tbl2.getColumnModel().getColumn(2).setHeaderValue("LS SECUNDARIAS");
            tbl2.getColumnModel().getColumn(3).setHeaderValue("TOTAL");
        }

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel17.setText("Tabla 3. Ls. ext. según tamaños en desechos de talla (enteros y fracturados con talón)");

        tbl3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"1", "", ""},
                {"2", "", ""},
                {"3", "", ""},
                {"4", null, null}
            },
            new String [] {
                "TAMAÑO", "LS EXTERNAS", "TOTAL"
            }
        ));
        tbl3.setGridColor(new java.awt.Color(255, 102, 102));
        tbl3.setRowHeight(25);
        tbl3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl3MouseClicked(evt);
            }
        });
        jScrollPane8.setViewportView(tbl3);

        jLabel12.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel12.setText("Índice de corticalidad en ÚTILES = Bx100/A");

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

        jLabel11.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel11.setText("Índice de corticalidad en DT  ent. y frac. con talón = Bx100/A");

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

        fila2.setBackground(new java.awt.Color(204, 204, 255));
        fila2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila2.setText("Ordenar por fila");

        columna2.setBackground(new java.awt.Color(204, 204, 255));
        columna2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna2.setText("Ordenar por columna");

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

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

        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_info1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/info.png"))); // NOI18N
        btn_info1.setToolTipText("Información sobre el análisis");
        btn_info1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_info1ActionPerformed(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);
            }
        });

        tbl8.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl8.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"A-0%", null, null},
                {"B-0.1-25%", null, null},
                {"C-25.1-50%", null, null},
                {"D-50.1-75%", null, null},
                {"E-75.1-99%", null, null},
                {"F-100%", null, null},
                {"CN", null, null}
            },
            new String [] {
                "Corteza reservada", "N (Útiles)", "TOTAL"
            }
        ));
        tbl8.setGridColor(new java.awt.Color(255, 102, 102));
        tbl8.setRowHeight(25);
        tbl8.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl8MouseClicked(evt);
            }
        });
        jScrollPane12.setViewportView(tbl8);

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel7.setText("Tabla 1. Lascas primarias y secundarias según tamaño en formas base - utiles");

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

        tbl9.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl9.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"A-0%", null, null, null},
                {"B-0.1-25%", null, null, null},
                {"C-25.1-50%", null, null, null},
                {"D-50.1-75%", null, null, null},
                {"E-75.1-99%", null, null, null},
                {"F-100%", null, null, null},
                {"CN", null, null, null}
            },
            new String [] {
                "Corteza reservada", "ENTEROS Y Frac.C/T", "FRACTURADOS ST", "TOTAL"
            }
        ));
        tbl9.setGridColor(new java.awt.Color(255, 102, 102));
        tbl9.setRowHeight(25);
        tbl9.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl9MouseClicked(evt);
            }
        });
        jScrollPane13.setViewportView(tbl9);

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

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel8.setText("Tabla 4. Proporción de corteza en DT");

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

        jLabel28.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel28.setText("(A) N Útiles");

        jLabel29.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel29.setText("(B) N  Ls. Prim.+ Ls. Sec.");

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

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

        jLabel30.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel30.setText("(A) N DT ent.y frac.CT");

        jLabel31.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel31.setText("(B) N  Ls. Ext.");

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

        fila8.setBackground(new java.awt.Color(204, 204, 255));
        fila8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila8.setText("Ordenar por fila");

        columna8.setBackground(new java.awt.Color(204, 204, 255));
        columna8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna8.setText("Ordenar por columna");

        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_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);
            }
        });

        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()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                .addComponent(txt_indice_cor_DT, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(10, 10, 10)
                                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGap(45, 45, 45))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(txt_n_dt, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(16, 16, 16)
                                        .addComponent(txt_DT_lsext, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addContainerGap()
                                        .addComponent(btn_info1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(btn_arbol1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 668, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 512, 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))
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 490, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 533, Short.MAX_VALUE)
                                            .addComponent(jScrollPane12, javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                                .addGap(6, 6, 6)
                                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                                        .addComponent(txt_indice_corticalidad_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(10, 10, 10)
                                                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 409, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                                        .addComponent(txt_n_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(10, 10, 10)
                                                        .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(18, 18, 18)
                                                        .addComponent(txt_n_lsprimsec, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addGap(10, 10, 10)
                                                        .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(btn_copiar4, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(btn_copiar1, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addGap(0, 109, Short.MAX_VALUE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 719, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 58, Short.MAX_VALUE)))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(fila2)
                                        .addGap(18, 18, 18)
                                        .addComponent(columna2))
                                    .addComponent(jpanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 492, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(34, 34, 34))
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jpanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 488, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(jpanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 485, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(3, 3, 3))
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                    .addComponent(fila8)
                                    .addGap(18, 18, 18)
                                    .addComponent(columna8)))
                            .addComponent(jpanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 488, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 511, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 511, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btn_copiar6, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btn_arbol1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btn_info1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(fila2)
                        .addComponent(columna2)))
                .addGap(13, 13, 13)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 178, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btn_copiar1, 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(txt_n_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txt_n_lsprimsec, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txt_indice_corticalidad_utiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jpanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(44, 44, 44)
                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jpanel10, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE)
                            .addComponent(jScrollPane12, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(45, 45, 45)
                                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 20, 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, 203, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(btn_copiar5, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(jpanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(16, 16, 16)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(txt_n_dt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txt_DT_lsext, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txt_indice_cor_DT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(btn_copiar4, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(69, 69, 69)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(fila8)
                        .addComponent(columna8)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane13, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jpanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 214, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btn_copiar6, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(54, Short.MAX_VALUE))
        );

        jPanel4.setBackground(new java.awt.Color(153, 255, 204));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Laminaridad sobre lascas y hojas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 16))); // NOI18N
        jPanel4.setForeground(new java.awt.Color(153, 255, 204));

        tbl4.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        tbl4.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"MODULO A", "", "", "", "", ""},
                {"MODULO B", "", "", "", "", ""},
                {"MODULO C", "", "", "", "", ""}
            },
            new String [] {
                "LAMINARIDAD", "UTILES - LASCAS", "UTILES-  HOJAS", "DT/CT - LASCAS", "DT/CT - HOJAS", "TOTAL"
            }
        ));
        tbl4.setGridColor(new java.awt.Color(255, 102, 102));
        tbl4.setRowHeight(25);
        tbl4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl4MouseClicked(evt);
            }
        });
        jScrollPane7.setViewportView(tbl4);

        fila3.setBackground(new java.awt.Color(153, 255, 204));
        fila3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila3.setText("Ordenar por fila");

        columna3.setBackground(new java.awt.Color(153, 255, 204));
        columna3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna3.setText("Ordenar por columna");

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

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

        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);
            }
        });

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

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel3.setText("Indice de laminaridad en utiles");

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

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel9.setText("Indice de hojas");

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

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

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

        jLabel34.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel34.setText("N° de utiles (100%)");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(btn_info2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, 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))
                            .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 720, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                                .addComponent(fila3)
                                .addGap(18, 18, 18)
                                .addComponent(columna3))
                            .addComponent(jpanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 487, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(22, 22, 22))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel34))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel10))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel9))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel3)))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fila3)
                            .addComponent(columna3))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jpanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel4Layout.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(btn_info2, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel34))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jPanel5.setBackground(new java.awt.Color(255, 204, 204));
        jPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        txt_n_hojasenutiles.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel18.setText("n HOJAS en UTILES");

        txt_n_lascasenutiles.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel19.setText("n LASCAS en UTILES");

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

        txt_n_hojasendt.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel25.setText("n HOJAS en DT (con talón)");

        txt_n_lascasendt.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel26.setText("n LASCAS en DT (con talón)");

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

        jLabel32.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel32.setText("% LASCAS en DT (con talón)");

        txt_porc_lascasDT.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
        txt_porc_lascasDT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txt_porc_lascasDTActionPerformed(evt);
            }
        });

        txt_porc_hojasDT.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel33.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel33.setText("% HOJAS en DT (con talón)");

        txt_porc_lascasUtiles.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel35.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel35.setText("% LASCAS en UTILES");

        txt_porc_hojasUtiles.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel36.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel36.setText("% HOJAS en UTILES");

        jPanel11.setBackground(new java.awt.Color(255, 204, 204));
        jPanel11.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel11.setToolTipText("");

        txt_n_utiles2.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel37.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel37.setText("N UTILES");

        txt_n_dt2.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel38.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel38.setText("N DT CT");

        txt_n_nucleosagotados.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel20.setText("N NUCLEOS GLOBULOSOS Y/O AGOTADOS");

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txt_n_utiles2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel37, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txt_n_dt2, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(txt_n_nucleosagotados, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2)
                .addComponent(jLabel20)
                .addGap(5, 5, 5))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(txt_n_utiles2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel37, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txt_n_dt2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txt_n_nucleosagotados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel38, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(15, Short.MAX_VALUE))
        );

        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(jPanel5Layout.createSequentialGroup()
                        .addComponent(btn_info3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btn_copiar3, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txt_n_hojasenutiles, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
                                    .addComponent(txt_n_lascasenutiles))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txt_n_hojasendt)
                                    .addComponent(txt_n_lascasendt, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txt_porc_hojasUtiles, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
                                    .addComponent(txt_porc_lascasUtiles))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txt_porc_hojasDT)
                                    .addComponent(txt_porc_lascasDT, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
                .addComponent(jpanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 488, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addGap(17, 17, 17)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btn_copiar3, 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))
                        .addGap(18, 18, 18)
                        .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(25, 25, 25)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(txt_n_hojasenutiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txt_porc_hojasUtiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(txt_n_lascasenutiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txt_porc_lascasUtiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel35, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(47, 47, 47)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(txt_n_hojasendt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txt_porc_hojasDT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel33, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                            .addComponent(txt_n_lascasendt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel26, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(txt_porc_lascasDT, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jpanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

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

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

        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);
            }
        });

        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:");

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

        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:");

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

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

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jPanel2, 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(jPanel4, 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))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cbx_mp, javax.swing.GroupLayout.PREFERRED_SIZE, 747, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(23, 23, 23)
                        .addComponent(jButton1))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .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.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addComponent(txt_muestra, javax.swing.GroupLayout.PREFERRED_SIZE, 395, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel16)
                                .addGap(18, 18, 18)
                                .addComponent(txt_sentencia, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(txt_mp_selec))))
                .addContainerGap(64, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(cbx_mp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addGap(27, 27, 27)
                .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(61, 61, 61)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(24, 24, 24)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(136, Short.MAX_VALUE))
        );

        jScrollPane1.setViewportView(jPanel1);

        jInternalFrame1.setClosable(true);
        jInternalFrame1.setMaximizable(true);
        jInternalFrame1.setResizable(true);
        jInternalFrame1.setTitle("Talla de extracción 2");

        jPanel7.setBackground(new java.awt.Color(255, 204, 204));
        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Forma de la plataforma en núcleos y en el talón de útiles", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 16))); // NOI18N

        tbl1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"forma1", "1", "3", "3"},
                {"forma2", "9", "0", "6"},
                {"forma3", "0", "5", "7"},
                {"forma4", "1", "1", "8"},
                {"forma5", "10", "15", "9"}
            },
            new String [] {
                "FORMA", "TALON UTILES", "PLAT NUCLEOS", "%"
            }
        ));
        tbl1.setGridColor(new java.awt.Color(255, 102, 102));
        tbl1.setRowHeight(25);
        tbl1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl1MouseClicked(evt);
            }
        });
        jScrollPane9.setViewportView(tbl1);

        fila4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila4.setText("Ordenar por fila");

        columna4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna4.setText("Ordenar por columna");

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

        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()
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 522, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(194, 194, 194)
                        .addComponent(fila4)
                        .addGap(18, 18, 18)
                        .addComponent(columna4)
                        .addContainerGap(12, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jpanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 435, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(fila4)
                    .addComponent(columna4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jpanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 7, Short.MAX_VALUE))
        );

        jPanel8.setBackground(new java.awt.Color(204, 204, 255));
        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Lascas primarias y secundarias según tamaño", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 16))); // NOI18N

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel6.setText("Sobre formas base - utiles");

        tbl5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl5.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"1", "10", "0", "10"},
                {"2", "0", "5", "20"},
                {"3", "10", "10", "30"},
                {"4", "2", "3", "40"}
            },
            new String [] {
                "TAMAÑO", "LS PRIMARIAS", "LS SECUNDARIAS", "%"
            }
        ));
        tbl5.setGridColor(new java.awt.Color(255, 102, 102));
        tbl5.setRowHeight(20);
        tbl5.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl5MouseClicked(evt);
            }
        });
        jScrollPane4.setViewportView(tbl5);

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel21.setText("Sobre desechos de talla");

        tbl6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl6.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"1", "0", "5", "10"},
                {"2", "10", "0", "20"},
                {"3", "10", "10", "30"},
                {"4", "15", "30", "40"}
            },
            new String [] {
                "TAMAÑO", "LS PRIMARIAS", "LS SECUNDARIAS", "%"
            }
        ));
        tbl6.setGridColor(new java.awt.Color(255, 102, 102));
        tbl6.setRowHeight(20);
        tbl6.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbl6MouseClicked(evt);
            }
        });
        jScrollPane10.setViewportView(tbl6);

        jLabel13.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel13.setText("Índice de reserva de corteza en útiles");

        jLabel14.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
        jLabel14.setText("Índice de reserva de corteza en desechos de talla");

        fila5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila5.setText("Ordenar por fila");

        columna5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna5.setText("Ordenar por columna");

        fila6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila6.setText("Ordenar por fila");

        columna6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna6.setText("Ordenar por columna");

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

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

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 490, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 530, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(10, 10, 10)
                        .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 420, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel8Layout.createSequentialGroup()
                                .addComponent(fila5)
                                .addGap(18, 18, 18)
                                .addComponent(columna5))
                            .addGroup(jPanel8Layout.createSequentialGroup()
                                .addComponent(fila6)
                                .addGap(18, 18, 18)
                                .addComponent(columna6)))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                        .addComponent(jpanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 435, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(19, 19, 19))))
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                    .addContainerGap(577, Short.MAX_VALUE)
                    .addComponent(jpanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 435, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(20, 20, 20)))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGap(27, 27, 27)
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fila5)
                            .addComponent(columna5))))
                .addGap(102, 102, 102)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fila6)
                            .addComponent(columna6))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jpanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 22, Short.MAX_VALUE))
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGap(49, 49, 49)
                    .addComponent(jpanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(297, Short.MAX_VALUE)))
        );

        jPanel9.setBackground(new java.awt.Color(153, 255, 204));
        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Laminaridad sobre lascas y hojas", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 16))); // NOI18N
        jPanel9.setForeground(new java.awt.Color(153, 255, 204));

        tbl7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        tbl7.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {"1", "4", "0", "10", "1", "20"},
                {"2", "5", "5", "11", "10", "30"},
                {"3", "6", "6", "0", "0", "40"},
                {"4", "0", "9", "0", "9", "50"}
            },
            new String [] {
                "LAMINARIDAD", "FB - LASCAS", "FB-  HOJAS", "DT - LASCAS", "DT - HOJAS", "TOTALES"
            }
        ));
        tbl7.setGridColor(new java.awt.Color(255, 102, 102));
        tbl7.setRowHeight(20);
        jScrollPane11.setViewportView(tbl7);

        fila7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        fila7.setText("Ordenar por fila");

        columna7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        columna7.setText("Ordenar por columna");

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

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 511, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                        .addComponent(fila7)
                        .addGap(18, 18, 18)
                        .addComponent(columna7))
                    .addComponent(jpanel8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 435, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(22, 22, 22))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fila7)
                            .addComponent(columna7))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jpanel8, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(0, 18, Short.MAX_VALUE))
        );

        jPanel10.setBackground(new java.awt.Color(255, 204, 204));
        jPanel10.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jTextField14.setText("30");

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel22.setText("% HOJAS / UTILES");

        jTextField15.setText("50");

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel23.setText("% LASCAS / UTILES");

        jTextField16.setText("60");

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel24.setText("% NUCLEOS AGOTADOS");

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

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jTextField14, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)
                    .addComponent(jTextField15)
                    .addComponent(jTextField16))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jpanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 435, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(24, 24, 24))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(19, Short.MAX_VALUE)
                .addComponent(jpanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

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

        jComboBox2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Cuarcita", "Basalto", "Etc." }));

        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(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGap(0, 8, Short.MAX_VALUE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jComboBox2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(39, 39, 39)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(29, 29, 29)
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(1051, Short.MAX_VALUE))
        );

        jScrollPane3.setViewportView(jPanel6);

        javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
        jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
        jInternalFrame1Layout.setHorizontalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
        );
        jInternalFrame1Layout.setVerticalGroup(
            jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1335, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 667, Short.MAX_VALUE)
                    .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 668, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 2776, Short.MAX_VALUE)
                .addGap(0, 0, 0))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 1388, Short.MAX_VALUE)
                    .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 1388, Short.MAX_VALUE)))
        );

        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){
             if(fila.isSelected()==true){

            
        Graficos graf = new Graficos();
        graf.generargraficofila2(tbl, jpanel, tbl.getValueAt(filaselec,0).toString(), "Útiles o Plat. nucleos");
            
        } }
        
        int col=tbl.getColumnCount()-1;
        int columnaselec = tbl.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
              if(columna.isSelected()==true){
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl, jpanel, tbl.getColumnName(columnaselec), "Forma plat o talon");
            
        }}

    
           
    
    }//GEN-LAST:event_tblMouseClicked

    private void tbl2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl2MouseClicked
        int filaselec = tbl2.getSelectedRow();
        int filas = tbl2.getRowCount()-1;
        
        if(filaselec<filas){
             if(fila2.isSelected()==true){

            
        Graficos graf = new Graficos();
        graf.generargraficofila2(tbl2, jpanel1, tbl2.getValueAt(filaselec,0).toString(), "Ls. prim. o Ls. sec.");
            
        } }
        
        int col=tbl2.getColumnCount()-1;
        int columnaselec = tbl2.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
              if(columna2.isSelected()==true){
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl2, jpanel1, tbl2.getColumnName(columnaselec), "Tamaños");
            
        }}
           
           
    }//GEN-LAST:event_tbl2MouseClicked

    private void tbl3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl3MouseClicked
    
   
        int col=tbl3.getColumnCount()-1;
        int columnaselec = tbl3.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
             
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl3, jpanel2, tbl3.getColumnName(columnaselec), "Tamaños");
            
        }
    }//GEN-LAST:event_tbl3MouseClicked

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

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

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

    private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened

 CalculosBD c = new CalculosBD();
c.cargarmp(cbx_mp);       
        

    }//GEN-LAST:event_formInternalFrameOpened

    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(cbx_mp.getSelectedIndex()==0){
            JOptionPane.showMessageDialog(null, "Seleccione previamente una materia prima");
 }else{


jpanel1.removeAll();
jpanel10.removeAll();
jpanel2.removeAll();
jpanel11.removeAll();
jpanel3.removeAll();
jpanel4.removeAll();
jpanel.removeAll();

        txt_muestra.setText(ARQL2020.etiqueta_muestra);
        txt_sentencia.setText(ARQL2020.WHERE);
        txt_mp_selec.setText(cbx_mp.getSelectedItem().toString());
        
        cargartbl1();
        cargartbl2();
        cargartbl8();
        cargartbl3();
        cargartbl9();
        cargartbl4();
        contabilizarporcentajeshojaslascas();
        btn_arbol.setEnabled(true);
        btn_arbol1.setEnabled(true);
        btn_arbol2.setEnabled(true);
 }
      
     
    }//GEN-LAST:event_btn_calcularActionPerformed
private void contabilizarporcentajeshojaslascas(){

CalculosBD calc=new CalculosBD();
String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());

String utiles = calc.getCount("FORMATIZADOS f", txt_sentencia.getText() + ids);
String DT = calc.getCount("DT_CONTALON2 f", txt_sentencia.getText() + "AND (f.MP='"+txt_mp_selec.getText()+"') ");
String nucleos_agot = contarnucleosagotados();
txt_n_utiles2.setText(utiles);
txt_n_dt2.setText(DT);
txt_n_nucleosagotados.setText(nucleos_agot);

    int mod_a  = Integer.parseInt(tbl4.getValueAt(0, 1).toString());
    int mod_b  = Integer.parseInt(tbl4.getValueAt(1, 1).toString());
    int mod_c  = Integer.parseInt(tbl4.getValueAt(2, 1).toString());
    int suma = mod_a + mod_b + mod_c;
    
    txt_n_lascasenutiles.setText(String.valueOf(suma));

    mod_a  = Integer.parseInt(tbl4.getValueAt(0, 2).toString());
    mod_b  = Integer.parseInt(tbl4.getValueAt(1, 2).toString());
    mod_c  = Integer.parseInt(tbl4.getValueAt(2, 2).toString());
    suma = mod_a + mod_b + mod_c;
    
    txt_n_hojasenutiles.setText(String.valueOf(suma));

    mod_a  = Integer.parseInt(tbl4.getValueAt(0, 3).toString());
    mod_b  = Integer.parseInt(tbl4.getValueAt(1, 3).toString());
    mod_c  = Integer.parseInt(tbl4.getValueAt(2, 3).toString());
    suma = mod_a + mod_b + mod_c;
    
    txt_n_lascasendt.setText(String.valueOf(suma));

    mod_a  = Integer.parseInt(tbl4.getValueAt(0, 4).toString());
    mod_b  = Integer.parseInt(tbl4.getValueAt(1, 4).toString());
    mod_c  = Integer.parseInt(tbl4.getValueAt(2, 4).toString());
    suma = mod_a + mod_b + mod_c;
    
    txt_n_hojasendt.setText(String.valueOf(suma));
    

    float a = calc.porcentajeCIENPORCIENTO(txt_n_lascasenutiles.getText(), txt_n_utiles2.getText());
    String aux = String.valueOf(a);
    txt_porc_lascasUtiles.setText(aux);
    
    a = calc.porcentajeCIENPORCIENTO(txt_n_hojasenutiles.getText(), txt_n_utiles2.getText());
    aux = String.valueOf(a);
    txt_porc_hojasUtiles.setText(aux);
    
    a = calc.porcentajeCIENPORCIENTO(txt_n_lascasendt.getText(), txt_n_dt2.getText());
    aux = String.valueOf(a);
    txt_porc_lascasDT.setText(aux);

    a = calc.porcentajeCIENPORCIENTO(txt_n_hojasendt.getText(), txt_n_dt2.getText());
    aux = String.valueOf(a);
    txt_porc_hojasDT.setText(aux);
   
    

DefaultCategoryDataset ds = new DefaultCategoryDataset();
try{

        float aux1 = Float.parseFloat(txt_porc_lascasUtiles.getText());
        ds.addValue(aux1, "%Lascas/Utiles", "");
        float aux2 = Float.parseFloat(txt_porc_hojasUtiles.getText());
        ds.addValue(aux2, "%Hojas/Utiles", "");

        float aux3 = Float.parseFloat(txt_porc_lascasDT.getText());
        ds.addValue(aux3, "%Lascas/DT ct", "");
    
        float aux4 = Float.parseFloat(txt_porc_hojasDT.getText());
        ds.addValue(aux4, "%Hojas/DT ct", "");
    
    
    JFreeChart jf =ChartFactory.createBarChart3D("Laminaridad sobre lascas y hojas", "LS/Ho según útiles o DT ct", "Porcentajes", ds, PlotOrientation.HORIZONTAL, true, true, true);

    
    CategoryPlot barchrt = jf.getCategoryPlot();
    barchrt.setRangeGridlinePaint(Color.ORANGE);
    ChartPanel barpanel = new ChartPanel(jf);
    jpanel4.removeAll();
    jpanel4.add(barpanel, BorderLayout.CENTER);
    jpanel4.validate();
    

}catch (Exception ex){
    JOptionPane.showMessageDialog(null, "No se puede generar gráfico de porcentajes");
}
    
    
    
}
 private String contarnucleosagotados(){
      Object valor =0;
    ResultSet rs = null;
    ArrayList<Integer> ids = new ArrayList<>();
    String consulta = "SELECT DISTINCT (f.ID_FORMATIZADOS)  FROM FORMATIZADOS f \n"  +
        "INNER JOIN \n" +
"NUCLEOS n \n" +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " 
        +txt_sentencia.getText() + " AND (f.MP='"+txt_mp_selec.getText()+"') AND (n.SUBGRUPO='5-Globuloso o agotado') ";
        
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                ids.add(rs.getInt("ID_FORMATIZADOS"));
                
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     valor = ids.size();
     String a = String.valueOf(valor);
     return a;
     
 }   
    private void cargartbl4(){
        
             DefaultTableModel dtm = (DefaultTableModel) tbl4.getModel();          
        
        if(dtm.getRowCount()==4){
            dtm.removeRow(3);
        }
        
     
        
        contabilizarutilesmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "A", lascasutiles, 0, 1);
        contabilizarutilesmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "B", lascasutiles, 1, 1);
        contabilizarutilesmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "C", lascasutiles, 2, 1);
        
        contabilizarutilesmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "A", hojasutiles, 0, 2);
        contabilizarutilesmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "B", hojasutiles, 1, 2);
        contabilizarutilesmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "C", hojasutiles, 2, 2);
        
        contabilizarDTmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "A", lascasDT, 0, 3);
        contabilizarDTmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "B", lascasDT, 1, 3);
        contabilizarDTmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "C", lascasDT, 2, 3);
        
        contabilizarDTmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "A", hojasdt, 0, 4);
        contabilizarDTmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "B", hojasdt, 1, 4);
        contabilizarDTmodulo(txt_sentencia.getText(), txt_mp_selec.getText(), "C", hojasdt, 2, 4);
        
        tbl4.setValueAt("0", 0, 5);
        tbl4.setValueAt("0", 1, 5);
        tbl4.setValueAt("0", 2, 5);
        
        
       
        CalculosBD calc = new CalculosBD();
        calc.sumartotalesfila(dtm);
        calc.sumartotalescolumna(dtm);
        calc.porcentajesfilainferior(dtm);
}
private void contabilizarDTmodulo (String where, String MP, String modulo, String formabase, int fila, int col){
    int Cant = 0;
 ResultSet rs = null;
 
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT COUNT(f.ID_DT_CONTALON) FROM DT_CONTALON2 f "+
                      where + " AND (f.MP='"+MP+"') AND (f.MODULO_LONG_ANCHO='"+modulo+"') "+ formabase);
         
             
               if(rs.next()){
               Cant = rs.getInt("1");               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

      tbl4.setValueAt(Cant, fila, col);
}
private void contabilizarutilesmodulo (String where, String MP, String modulo, String formabase, int fila, int col){
    int Cant = 0;
CalculosBD calc=new CalculosBD();
String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
 ResultSet rs = null;
 
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT COUNT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      where + " AND (f.MP='"+MP+"')"+  ids + " AND (f.MODULO_LONG_ANCHO='"+modulo+"') "+ formabase);
         
             
               if(rs.next()){
               Cant = rs.getInt("1");               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

      tbl4.setValueAt(Cant, fila, col);
}
    
    private void cargartbl2(){
DefaultTableModel dtm = (DefaultTableModel) tbl2.getModel();
        if(dtm.getRowCount()==5){
            dtm.removeRow(4);
        }
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "1", "LsP-Lasca primaria o cortical", 0, 1);
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "2", "LsP-Lasca primaria o cortical", 1, 1);
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "3", "LsP-Lasca primaria o cortical", 2, 1);
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "4", "LsP-Lasca primaria o cortical", 3, 1);
    
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "1", "LsS-Lasca secundaria o de descortezamiento", 0, 2);
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "2", "LsS-Lasca secundaria o de descortezamiento", 1, 2);
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "3", "LsS-Lasca secundaria o de descortezamiento", 2, 2);
    contabilizarLSporTamaño(txt_sentencia.getText(), txt_mp_selec.getText(), "4", "LsS-Lasca secundaria o de descortezamiento", 3, 2);
    
    tbl2.setValueAt("0", 0, 3);
    tbl2.setValueAt("0", 1, 3);
    tbl2.setValueAt("0", 2, 3);
    tbl2.setValueAt("0", 3, 3);
            
            CalculosBD calc = new CalculosBD();
            calc.sumartotalesfila(dtm);
            calc.sumartotalescolumna(dtm);
            calc.porcentajesfilainferior(dtm);
            
            String ls_pim_sec = " AND (f.FORMA_BASE= 'LsP-Lasca primaria o cortical' OR f.FORMA_BASE='LsS-Lasca secundaria o de descortezamiento' )";
            String MP = " AND (f.MP= '"+txt_mp_selec.getText()+"')";
            String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
            String a = calc.getCount("FORMATIZADOS f ", txt_sentencia.getText() + ids + MP );
            String b = calc.getCount("FORMATIZADOS f ", txt_sentencia.getText()+ ids + ls_pim_sec + MP);
            
            txt_n_utiles.setText(a);
            txt_n_lsprimsec.setText(b);
            float d = calc.porcentajeCIENPORCIENTO(b, a);
            txt_indice_corticalidad_utiles.setText(String.valueOf(d));
            
}
    

    private void contabilizarLSporTamaño(String where, String MP, String Tamaño, String FORMABASE, int fila, int col){
int Cant = 0;
CalculosBD calc=new CalculosBD();
String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
 ResultSet rs = null;
 
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT COUNT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      where + " AND (f.MP='"+MP+"')"+  ids + " AND (f.TAMAÑO='"+Tamaño+"') AND (f.FORMA_BASE= '"+FORMABASE+"')");
         
             
               if(rs.next()){
               Cant = rs.getInt("1");               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

      tbl2.setValueAt(Cant, fila, col);
    }
    
    private void limpiartabla(DefaultTableModel dtm){
    int filas=dtm.getRowCount();
            for (int i = 0;filas>i; i++) {
                dtm.removeRow(0);
}
}
    private void cargartbl9(){
       DefaultTableModel dtm = (DefaultTableModel) tbl9.getModel();  
        if(dtm.getRowCount()==8){
            dtm.removeRow(7);
        } 
        contabilizarDTstporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "A-0%", 0, 2);
        contabilizarDTstporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "B-0.1-25%", 1, 2);
        contabilizarDTstporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "C-25.1-50%", 2, 2);
        contabilizarDTstporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "D-50.1-75%", 3, 2);
        contabilizarDTstporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "E-75.1-99%", 4, 2);
        contabilizarDTstporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "F-100%", 5, 2);
        contabilizarDTstporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "CN", 6, 2);

        contabilizarDTCTporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "A-0%", 0, 1);
        contabilizarDTCTporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "B-0.1-25%", 1, 1);
        contabilizarDTCTporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "C-25.1-50%", 2, 1);
        contabilizarDTCTporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "D-50.1-75%", 3, 1);
        contabilizarDTCTporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "E-75.1-99%", 4, 1);
        contabilizarDTCTporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "F-100%", 5, 1);
        contabilizarDTCTporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "CN", 6, 1);
        
        dtm.setValueAt("0", 0,3);
        dtm.setValueAt("0", 1, 3);
        dtm.setValueAt("0", 2, 3);
        dtm.setValueAt("0", 3, 3);
        dtm.setValueAt("0", 4, 3);
        dtm.setValueAt("0", 5, 3);
        dtm.setValueAt("0", 6, 3);
       
        CalculosBD calc = new CalculosBD();
            calc.sumartotalesfila(dtm);
            calc.sumartotalescolumna(dtm);
            calc.porcentajesfilainferior(dtm);
    }
    private void contabilizarDTCTporCORTEZA(String where, String MP, String corteza, int fila, int col){
        int Cant = 0;

 ResultSet rs = null;
 
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT COUNT(*) FROM DT_CONTALON2 f "+
                      where + " AND (f.MP='"+MP+"')  AND (f.CORTEZA_CARA_DORSAL='"+corteza+"') ");
         
             
               if(rs.next()){
               Cant = rs.getInt("1");               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

      tbl9.setValueAt(Cant, fila, col);
    }
    private void contabilizarDTstporCORTEZA(String where, String MP, String corteza, int fila, int col){
        int Cant = 0;

 ResultSet rs = null;
 
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT COUNT(*) FROM DT_SINTALON2 f "+
                      where + " AND (f.MP='"+MP+"')  AND (f.CORTEZA='"+corteza+"') ");
         
             
               if(rs.next()){
               Cant = rs.getInt("1");               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

      tbl9.setValueAt(Cant, fila, col);
    }
    
    private void cargartbl8(){
     DefaultTableModel dtm = (DefaultTableModel) tbl8.getModel();          
        
        if(dtm.getRowCount()==8){
            dtm.removeRow(7);
        }
        contabilizarUTILESporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "A-0%", 0, 1);
        contabilizarUTILESporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "B-0.1-25%", 1, 1);
        contabilizarUTILESporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "C-25.1-50%", 2, 1);
        contabilizarUTILESporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "D-50.1-75%", 3, 1);
        contabilizarUTILESporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "E-75.1-99%", 4, 1);
        contabilizarUTILESporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "F-100%", 5, 1);
        contabilizarUTILESporCORTEZA(txt_sentencia.getText(), txt_mp_selec.getText(), "CN", 6, 1);
        
        dtm.setValueAt("0", 0,2);
        dtm.setValueAt("0", 1, 2);
        dtm.setValueAt("0", 2, 2);
        dtm.setValueAt("0", 3, 2);
        dtm.setValueAt("0", 4, 2);
        dtm.setValueAt("0", 5, 2);
        dtm.setValueAt("0", 6, 2);
        
        CalculosBD calc = new CalculosBD();
            calc.sumartotalesfila(dtm);
            calc.sumartotalescolumna(dtm);
            calc.porcentajesfilainferior(dtm);
    }

    private void contabilizarUTILESporCORTEZA(String where, String MP, String corteza, int fila, int col){
int Cant = 0;
CalculosBD calc=new CalculosBD();
String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
 ResultSet rs = null;
 
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT COUNT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      where + " AND (f.MP='"+MP+"')"+  ids + " AND (f.CORTEZA='"+corteza+"') ");
         
             
               if(rs.next()){
               Cant = rs.getInt("1");               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

      tbl8.setValueAt(Cant, fila, col);
    }
    
    
    private void cargartbl3(){
      DefaultTableModel dtm = (DefaultTableModel) tbl3.getModel();          
        
        if(dtm.getRowCount()==5){
            dtm.removeRow(4);
        }   
        
        contabilizarDT_LSEXT_TAM(txt_sentencia.getText(), txt_mp_selec.getText(), "1", 0, 1);
        contabilizarDT_LSEXT_TAM(txt_sentencia.getText(), txt_mp_selec.getText(), "2", 1, 1);
        contabilizarDT_LSEXT_TAM(txt_sentencia.getText(), txt_mp_selec.getText(), "3", 2, 1);
        contabilizarDT_LSEXT_TAM(txt_sentencia.getText(), txt_mp_selec.getText(), "4", 3, 1);
        
        tbl3.setValueAt(0, 0, 2);
        tbl3.setValueAt(0, 1, 2);
        tbl3.setValueAt(0, 2, 2);
        tbl3.setValueAt(0, 3, 2);
        
            CalculosBD calc = new CalculosBD();
            calc.sumartotalesfila(dtm);
            calc.sumartotalescolumna(dtm);
            calc.porcentajesfilainferior(dtm);
            
          String MP = " AND (f.MP= '"+txt_mp_selec.getText()+"')";
            String a = calc.getCount("DT_CONTALON2 f ", txt_sentencia.getText() + MP );
            String b = calc.getCount("DT_CONTALON2 f ", txt_sentencia.getText()+  MP + "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa')");
            
            txt_n_dt.setText(a);
            txt_DT_lsext.setText(b);
            float d = calc.porcentajeCIENPORCIENTO(b, a);
            txt_indice_cor_DT.setText(String.valueOf(d));  
            
    }
    
    private void contabilizarDT_LSEXT_TAM (String where, String MP, String tam,  int fila, int col){
        int Cant = 0;

 ResultSet rs = null;
 
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta("SELECT COUNT(*) FROM DT_CONTALON2 f "+
                      where + " AND (f.MP='"+MP+"')"+  " AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='"+tam+"') ");
         
             
               if(rs.next()){
               Cant = rs.getInt("1");               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

      tbl3.setValueAt(Cant, fila, col);
        
    }
    private void cargartbl1(){
    DefaultTableModel dtm = (DefaultTableModel) tbl.getModel();
    limpiartabla(dtm);
    
    getDISTINCT_formaplataforma_Nu_Utiles(txt_sentencia.getText(), txt_mp_selec.getText(), dtm);
    for (int i = 0; i < dtm.getRowCount(); i++) {
        contartalonesutiles(dtm.getValueAt(i, 0).toString(), txt_sentencia.getText(), txt_mp_selec.getText(), dtm, i, 1);
        contartalonesPlataformas(dtm.getValueAt(i, 0).toString(), txt_sentencia.getText(), txt_mp_selec.getText(), dtm, i, 2);
    }
                CalculosBD calc = new CalculosBD();
            calc.sumartotalesfila(dtm);
            calc.sumartotalescolumna(dtm);
            calc.porcentajesfilainferior(dtm);
}
private void contartalonesutiles(String talon, String where, String MP, DefaultTableModel dtm, int fila, int col){

CalculosBD calc=new CalculosBD();
String ids=calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());

    Object valor =0;
    ResultSet rs = null; 
    String consulta = "SELECT COUNT (*)  FROM FORMATIZADOS f \n"  +
       where + " AND (f.MP='"+MP+"') AND (f.SUP_TALON='"+talon+"') " + ids;
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            if(rs.next()){
                valor=(rs.getInt("1"));
                
            }       
        
        c.closeconnection();
        
     
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
     
     
        dtm.setValueAt(valor, fila, col);
}
private void contartalonesPlataformas(String talon, String where, String MP, DefaultTableModel dtm, int fila, int col){
    
 
    Object valor =0;
    ResultSet rs = null; 
    String consulta = "SELECT COUNT (*)  FROM NUCLEOS n \n"  +
        "INNER JOIN \n" +
"FORMATIZADOS f \n" +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " 
        +where + " AND (f.MP='"+MP+"') AND (n.PLAT_FORMA_SUP='"+talon+"') ";
        
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            if(rs.next()){
                valor=(rs.getInt("1"));
                
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }dtm.setValueAt(valor, fila, col);
}
private void getDISTINCT_formaplataforma_Nu_Utiles(String where, String MP, DefaultTableModel dtm){
CalculosBD calc=new CalculosBD();
String ids=calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
    
    int nummods=0;
   ArrayList<String> lista = new ArrayList<>();
    Object [] fila = new Object[4];
    fila[0]=0;
    fila[1]=0;
    fila[2]=0;
    fila[3]=0;
ResultSet rs = null; 
String consulta = "SELECT DISTINCT (f.SUP_TALON)  FROM FORMATIZADOS f \n"  +
        where + " AND (f.MP='"+MP+"') "+ids;
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                lista.add(rs.getString("SUP_TALON"));
                
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }

     consulta = "SELECT DISTINCT (n.PLAT_FORMA_SUP)  FROM FORMATIZADOS f \n"  +
        "INNER JOIN \n" +
"NUCLEOS n \n" +
"ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " 
        +where + " AND (f.MP='"+MP+"') ";
       
     try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(consulta);

            while(rs.next()){
                lista.add(rs.getString("PLAT_FORMA_SUP"));
                
            }       
        
        c.closeconnection();
        
        
        } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
     
     
     
     Set<String> hashSet = new HashSet<String>(lista);
        lista.clear();
        lista.addAll(hashSet);
        
     for (int i = 0; i < lista.size(); i++) {
        fila[0]=lista.get(i);
        dtm.addRow(fila);
    }
    
}



    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("FORMA DE LA PLATAFORMA EN NUCLEOS Y EN EL TALON DE ÚTILES:\n" +
"\n" +
"Se analiza la presencia diferencial de formas de plataforma de núcleos y formas de talón en útiles según la MP seleccionada para la muestra: \n" +
"\n" +
"\n" +
"Útiles: comprende todos los grupos tipológicos, a excepción de núcleos. \n"
                + "-----FICHAS GENERALES asociadas a FICHAS SEMENTALES +  \n" 
                 
                + "-----FICHAS GENERALES asociadas a FICHAS DE PUNTAS DE PROYECTIL   \n" 
+"\n" 
+"\n" +
"Plataformas de núcleos: se contabilizan todas las plataformas de núcleos correspondientes a la muestra. Es decir, cada plataforma vale 1"
 + "\n-----FICHAS GENERALES asociadas a FICHAS DE NUCLEOS   \n");
    }//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);
arbol_1_alternativo();
    }//GEN-LAST:event_btn_arbolActionPerformed

    private void arbol_1_alternativo(){
Arbol ar = new Arbol();
ar.setVisible(true);
ar.txt_mp.setText(txt_mp_selec.getText());
 
DefaultTreeModel model = (DefaultTreeModel) ar.arbol_analisis_FORM.getModel();        
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    
String sentencia = txt_sentencia.getText();
String matprim = txt_mp_selec.getText();
CalculosBD calc=new CalculosBD();
String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());

DefaultMutableTreeNode hoja_utiles = new DefaultMutableTreeNode("UTILES");
DefaultMutableTreeNode hoja_nucleos = new DefaultMutableTreeNode("NUCLEOS");

    DiseñoArbol d = new DiseñoArbol(txt_sentencia.getText(), txt_mp_selec.getText());

        for (int i = 0; i < tbl.getRowCount()-1; i++) {
            String categoria_tabla = tbl.getValueAt(i, 0).toString();
    String Utiles =  "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f   "  +
     sentencia + " AND (f.MP='"+matprim+"') AND (f.SUP_TALON='"+categoria_tabla+"') " + ids;
    ArrayList<Integer> ids_arbol = d.solicitar_ids(Utiles);
    DefaultMutableTreeNode hoja_categoriaA = d.armarcarpetaconpiezas(ids_arbol, categoria_tabla);
    hoja_utiles.add(hoja_categoriaA);

        }
        
String concat = concatenarformaplataformanucleos();
        System.out.println("concat:" + concat);
            
        
        for (int i = 0; i < tbl.getRowCount()-1; i++) {
            String categoria_tabla = tbl.getValueAt(i, 0).toString();
    String NUCLEOS =  "SELECT DISTINCT(f.ID_FORMATIZADOS), f.PIEZA FROM FORMATIZADOS f "
                     + " INNER JOIN "
                     + " NUCLEOS n " 
                     +" ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " 
                     + sentencia + " AND (f.MP='"+matprim+"') AND (n.PLAT_FORMA_SUP='"+categoria_tabla+"')" ;
    ArrayList<Integer> ids_arbol = d.solicitar_ids(NUCLEOS);
    DefaultMutableTreeNode hoja_categoriaA = d.armarcarpetaconpiezas(ids_arbol, categoria_tabla);
    hoja_nucleos.add(hoja_categoriaA);

        }
        
    root.add(hoja_utiles);
    root.add(hoja_nucleos);
    root.setUserObject(txt_muestra.getText()+"/ "+txt_mp_selec.getText());
    ar.arbol_analisis_FORM.setModel(model);
    model.reload();
    ar.txt_mp.setText(txt_mp_selec.getText());
    ar.txt_nota.setText("");

    
    }
    
    
    public void arboltbl(String where, String MP, JTree tree){
//ResultSet rs = null; 
//    
////////////////////////////////////SELECCIONA ID PARA UTILES    
//ArrayList <String[]> utiles = new ArrayList<>();
//
//
//CalculosBD calc=new CalculosBD();
//String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
//        
//         try {
//            conexion c = new conexion();
//            c.getConexion();
//            
//             rs = c.consulta("SELECT DISTINCT(f.ID_FORMATIZADOS), f.PIEZA, f.SUP_TALON FROM FORMATIZADOS f "+
//                      where + " AND (f.MP='"+MP+"')"+  ids);
//         
//             
//               while(rs.next()){
//               String [] utiles_aux = new String[3];
//               utiles_aux[0]=String.valueOf(rs.getInt("ID_FORMATIZADOS"));
//               utiles_aux[1]=(rs.getString("PIEZA"));
//               utiles_aux[2]=(rs.getString("SUP_TALON"));
//                
//               utiles.add(utiles_aux);
//               
//           }       
//        
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }
//         
//         
//         
////////////////////////////////////SELECCIONA ID PARA SEGMENTAL ESTANDAR          
//ArrayList <int[]> estandar = new ArrayList<>();
//
//        try {
//            conexion c = new conexion();
//            c.getConexion();
//            
//             rs = c.consulta("SELECT ID_ESTANDAR, ID_FORMATIZADOS FROM SEGMENTAL_ESTANDAR2 f ");
//
//            while(rs.next()){
//                int []estandar_aux = new int [2];
//               estandar_aux[0]= rs.getInt("ID_ESTANDAR");
//               estandar_aux[1]= rs.getInt("ID_FORMATIZADOS");
//               estandar.add(estandar_aux);
//           }       
//        
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        
////////////////////////////////SELECCIONA ID PARA PUNTAS 
//
//ArrayList <int[]> puntas = new ArrayList<>();
//
//try {
//            conexion c = new conexion();
//            c.getConexion();
//            
//             rs = c.consulta("SELECT ID_PUNTAS, ID_FORMATIZADOS FROM PUNTAS_DE_PROYECTIL2");
//
//            while(rs.next()){
//                int [] puntas_aux = new int [2];
//               puntas_aux[0]= rs.getInt("ID_PUNTAS");
//               puntas_aux[1]= rs.getInt("ID_FORMATIZADOS");
//               puntas.add(puntas_aux);
//           }       
//        
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }
//
//
//
//
//////////////Carga de arboles
//DefaultTreeModel model = (DefaultTreeModel) tree.getModel();        
//DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
//
//
//DefaultMutableTreeNode hoja_utiles = new DefaultMutableTreeNode("Utiles (FORM+PNRC+FNRC)");
//DefaultMutableTreeNode hoja_forma = new DefaultMutableTreeNode();
//DefaultMutableTreeNode pieza = new DefaultMutableTreeNode(); 
//MutableTreeNode hoja;
//
//    
//        
//        for (int j = 0; j < tbl.getRowCount()-1; j++) {
//             
//             
//            for (int i = 0; i < utiles.size(); i++) {
//            String [] IDutiles = new String[3];
//            IDutiles = utiles.get(i);
//            int IDpieza = Integer.parseInt(IDutiles[0]);
//            
//            String formatalon = IDutiles[2];
////            System.out.println("IDPieza: "+IDpieza + " FORMA TALON: "+formatalon);
//            
//            if(formatalon.equals(tbl.getValueAt(j, 0).toString())){
//                hoja_forma = new DefaultMutableTreeNode("Talón: "+tbl.getValueAt(j, 0).toString());
////                System.out.println("COINCIDE FORMA: "+ formatalon);
//            
//                pieza = new DefaultMutableTreeNode(IDpieza);
//                hoja = new DefaultMutableTreeNode("Gen-"+IDutiles[0]+"/"+IDutiles[1]);
//                pieza.add(hoja);
//                
//                for (int k = 0; k < estandar.size(); k++) {
//                    int [] IDestandar = new int[2];
//                     IDestandar = estandar.get(k);
//                    if(IDpieza==IDestandar[1]){
//                    hoja = new DefaultMutableTreeNode("Seg"+"-"+IDestandar[0]+"/Pieza-"+IDestandar[1]);
//                    pieza.add(hoja);
//                    
//                    }
//                      }
//                for (int m = 0; m < puntas.size(); m++) {
//                    int [] IDpuntas = new int[2];
//                     IDpuntas = puntas.get(m);
//                    
//                     if(IDpieza==IDpuntas[1]){
//                    hoja = new DefaultMutableTreeNode("PP"+"-"+IDpuntas[0]+"/Pieza-"+IDpuntas[1]);
//                    pieza.add(hoja);
//                    }
//                      }
//             
//           hoja_forma.add(pieza);
//      hoja_utiles.add(hoja_forma);       
//                
//        
//    }
//          
//    }
//                
//      
//                }
//        
//        
//        //////////////////////////////NUCLEOS
//      DefaultMutableTreeNode hoja_nucleos = new DefaultMutableTreeNode("Núcleos"); 
//      
//      //OBTIENE DISTINCT DE ID_FORMATIZADOS PARA NU
//ArrayList <String[]> idformnu = new ArrayList<>();
//String concat = concatenarformaplataformanucleos();
//
//         try {
//            conexion c = new conexion();
//            c.getConexion();
//            String consulta = "SELECT DISTINCT(f.ID_FORMATIZADOS), f.PIEZA FROM FORMATIZADOS f "
//                     + " INNER JOIN "
//                     + " NUCLEOS n " 
//                     +" ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " 
//                     + where + " AND (f.MP='"+MP+"') "+concat;
//             
//             rs = c.consulta(consulta);
//         
//            
//               while(rs.next()){
//               String [] aux = new String[2];
//               aux[0]=String.valueOf(rs.getInt("ID_FORMATIZADOS"));
//               aux[1]=rs.getString("PIEZA");
//               idformnu.add(aux);
//           }       
//        
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }    
// 
//         
//         
//ArrayList <String[]> nucleos = new ArrayList<>();
//
//try {
//            conexion c = new conexion();
//            c.getConexion();
//            
//             rs = c.consulta("SELECT n.ID_NUCLEOS, n.ID_FORMATIZADOS, n.N_PLAT FROM NUCLEOS n"
//                     + " INNER JOIN "
//                     + " FORMATIZADOS f " 
//                     +" ON f.ID_FORMATIZADOS = n.ID_FORMATIZADOS " + where + " AND (f.MP='"+txt_mp_selec.getText()+"') " +concat);
//            while(rs.next()){
//               String [] nu = new String[3];
//               nu[0]= String.valueOf(rs.getInt("ID_NUCLEOS"));
//               nu[1]= String.valueOf(rs.getInt("ID_FORMATIZADOS"));
//               nu[2]= rs.getString("N_PLAT");
//               nucleos.add(nu);
//           }       
//        
//            
//            
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }         
// 
//
//
//////arma carpeta de nucleos
//DefaultMutableTreeNode piezanu = new DefaultMutableTreeNode(); 
//MutableTreeNode hojanu;
//
//
//for (int i = 0; i < idformnu.size(); i++) {
//                
//                    
//            
//             String [] auxids = idformnu.get(i);
//             String IDpieza = auxids[0];
//             int IDpiezaint = Integer.parseInt(IDpieza);
//           
//            
//                           
//            
//                piezanu = new DefaultMutableTreeNode(IDpieza);
//                hojanu = new DefaultMutableTreeNode("Gen-"+auxids[0]+"/"+auxids[1]);
//                piezanu.add(hojanu);
//                
//                for (int k = 0; k < estandar.size(); k++) {
//                    int [] IDestandar = new int[2];
//                     IDestandar = estandar.get(k);
//                    if(IDpiezaint==IDestandar[1]){
//                    hojanu = new DefaultMutableTreeNode("Seg"+"-"+IDestandar[0]+"/Pieza-"+IDestandar[1]);
//                    piezanu.add(hojanu);
//                    
//                    }
//                      }
//                for (int m = 0; m < puntas.size(); m++) {
//                    int [] IDpuntas = new int[2];
//                     IDpuntas = puntas.get(m);
//                    
//                     if(IDpiezaint==IDpuntas[1]){
//                    hojanu = new DefaultMutableTreeNode("PP"+"-"+IDpuntas[0]+"/Pieza-"+IDpuntas[1]);
//                    piezanu.add(hojanu);
//                    }
//                      }
//                    
//
//                for (int h = 0; h < nucleos.size(); h++) {
//                    String [] n = nucleos.get(h);
//                    if(IDpiezaint==Integer.parseInt(n[1])){
//                    hojanu = new DefaultMutableTreeNode("Nu"+"-"+n[0]+"/Pieza-"+n[1]+"/Plat-"+n[2]);
//                    piezanu.add(hojanu);
//                    }
//                    
//                      }
//               
//                hoja_nucleos.add(piezanu);
//                }
//      
//                root.add(hoja_utiles);
//                root.add(hoja_nucleos);
//                root.setUserObject(txt_muestra.getText()+"/ "+txt_mp_selec.getText());
//                tree.setModel(model);
//                model.reload();

}

   private void arbol_2_alternativo(){
Arbol ar = new Arbol();
ar.setVisible(true);
ar.txt_mp.setText(txt_mp_selec.getText());
 
DefaultTreeModel model = (DefaultTreeModel) ar.arbol_analisis_FORM.getModel();        
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    
String sentencia = txt_sentencia.getText();
String matprim = txt_mp_selec.getText();
CalculosBD calc=new CalculosBD();
String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());

DefaultMutableTreeNode lascas_primarias = new DefaultMutableTreeNode("LS. PRIMARIAS");
DefaultMutableTreeNode lascas_secundarias = new DefaultMutableTreeNode("LS. SECUNDARIAS");

    DiseñoArbol d = new DiseñoArbol(txt_sentencia.getText(), txt_mp_selec.getText());

        for (int i = 0; i < tbl2.getRowCount()-1; i++) {
            String categoria_tabla = tbl2.getValueAt(i, 0).toString();
    String Utiles =  "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f   "  +
     sentencia + " AND (f.MP='"+matprim+"') AND (f.FORMA_BASE='LsP-Lasca primaria o cortical') " + ids + "AND (f.TAMAÑO='"+categoria_tabla+"')";
    ArrayList<Integer> ids_arbol = d.solicitar_ids(Utiles);
    DefaultMutableTreeNode hoja_categoriaA = d.armarcarpetaconpiezas(ids_arbol, categoria_tabla);
    lascas_primarias.add(hoja_categoriaA);

        }
        for (int i = 0; i < tbl2.getRowCount()-1; i++) {
            String categoria_tabla = tbl2.getValueAt(i, 0).toString();
    String Utiles =  "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f   "  +
     sentencia + " AND (f.MP='"+matprim+"') AND (f.FORMA_BASE='LsS-Lasca secundaria o de descortezamiento') " + ids  + "AND (f.TAMAÑO='"+categoria_tabla+"')";
    ArrayList<Integer> ids_arbol = d.solicitar_ids(Utiles);
    DefaultMutableTreeNode hoja_categoriaA = d.armarcarpetaconpiezas(ids_arbol, categoria_tabla);
    lascas_secundarias.add(hoja_categoriaA);

        }
        


        
        
    root.add(lascas_primarias);
    root.add(lascas_secundarias);
    root.setUserObject(txt_muestra.getText()+"/UTILES/ "+txt_mp_selec.getText());
    ar.arbol_analisis_FORM.setModel(model);
    model.reload();
    ar.txt_mp.setText(txt_mp_selec.getText());
    ar.txt_nota.setText("");

       calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "TAMAÑO 1:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='1')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");
       calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "TAMAÑO 2:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='2')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");
       calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "TAMAÑO 3:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='3')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");
       calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "TAMAÑO 4:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='4')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");


    
    
    }
       
    
public void arboltbl2(String where, String MP, JTree tree1, JTree tree2){
//ResultSet rs = null; 
//
//String formabase = " AND (f.FORMA_BASE= 'LsP-Lasca primaria o cortical' OR f.FORMA_BASE='LsS-Lasca secundaria o de descortezamiento' )";
////////////////////////////////////SELECCIONA ID PARA UTILES    
//ArrayList <String[]> utiles = new ArrayList<>();
//
//
//CalculosBD calc=new CalculosBD();
//String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());
//        
//         try {
//            conexion c = new conexion();
//            c.getConexion();
//            
//             rs = c.consulta("SELECT DISTINCT(f.ID_FORMATIZADOS), f.PIEZA, f.FORMA_BASE, f.TAMAÑO FROM FORMATIZADOS f "+
//                      where + " AND (f.MP='"+MP+"')"+  ids + formabase);
//         
//             
//               while(rs.next()){
//               String [] utiles_aux = new String[4];
//               utiles_aux[0]=String.valueOf(rs.getInt("ID_FORMATIZADOS"));
//               utiles_aux[1]=(rs.getString("PIEZA"));
//               utiles_aux[2]=(rs.getString("FORMA_BASE"));
//               utiles_aux[3]=(rs.getString("TAMAÑO"));
//                
//               utiles.add(utiles_aux);
//               
//           }       
//        
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }
//         
//         
//         
////////////////////////////////////SELECCIONA ID PARA SEGMENTAL ESTANDAR          
//ArrayList <int[]> estandar = new ArrayList<>();
//
//        try {
//            conexion c = new conexion();
//            c.getConexion();
//            
//             rs = c.consulta("SELECT ID_ESTANDAR, ID_FORMATIZADOS FROM SEGMENTAL_ESTANDAR2 f ");
//
//            while(rs.next()){
//                int []estandar_aux = new int [2];
//               estandar_aux[0]= rs.getInt("ID_ESTANDAR");
//               estandar_aux[1]= rs.getInt("ID_FORMATIZADOS");
//               estandar.add(estandar_aux);
//           }       
//        
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        
////////////////////////////////SELECCIONA ID PARA PUNTAS 
//
//ArrayList <int[]> puntas = new ArrayList<>();
//
//try {
//            conexion c = new conexion();
//            c.getConexion();
//            
//             rs = c.consulta("SELECT ID_PUNTAS, ID_FORMATIZADOS FROM PUNTAS_DE_PROYECTIL2");
//
//            while(rs.next()){
//                int [] puntas_aux = new int [2];
//               puntas_aux[0]= rs.getInt("ID_PUNTAS");
//               puntas_aux[1]= rs.getInt("ID_FORMATIZADOS");
//               puntas.add(puntas_aux);
//           }       
//        
//        c.closeconnection();
// } catch (SQLException ex) {
//            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
//        }
//
//
//
//
//////////////Carga de arboles
//DefaultTreeModel model = (DefaultTreeModel) tree1.getModel();        
//DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
//
//
//DefaultMutableTreeNode hoja_utiles = new DefaultMutableTreeNode("Utiles (FORM+PNRC+FNRC)");
//DefaultMutableTreeNode hoja_lsprim = new DefaultMutableTreeNode("LsP-Lasca primaria o cortical");
//DefaultMutableTreeNode hoja_lssec = new DefaultMutableTreeNode("LsS-Lasca secundaria o de descortezamiento");
//DefaultMutableTreeNode hoja_tamaño1p = new DefaultMutableTreeNode("Tamaño1");
//DefaultMutableTreeNode hoja_tamaño2p = new DefaultMutableTreeNode("Tamaño2");
//DefaultMutableTreeNode hoja_tamaño3p = new DefaultMutableTreeNode("Tamaño3");
//DefaultMutableTreeNode hoja_tamaño4p = new DefaultMutableTreeNode("Tamaño4");
//DefaultMutableTreeNode hoja_tamaño1s = new DefaultMutableTreeNode("Tamaño1");
//DefaultMutableTreeNode hoja_tamaño2s = new DefaultMutableTreeNode("Tamaño2");
//DefaultMutableTreeNode hoja_tamaño3s = new DefaultMutableTreeNode("Tamaño3");
//DefaultMutableTreeNode hoja_tamaño4s = new DefaultMutableTreeNode("Tamaño4");
//DefaultMutableTreeNode pieza = new DefaultMutableTreeNode(); 
//MutableTreeNode hoja;
//
//    
//        
//        for (int j = 0; j < tbl2.getRowCount()-1; j++) {
//             
//             
//            for (int i = 0; i < utiles.size(); i++) {
//            String [] IDutiles = new String[3];
//            IDutiles = utiles.get(i);
//            int IDpieza = Integer.parseInt(IDutiles[0]);
//            
//            String formabasez = IDutiles[2];
//            String tamaño = IDutiles[3];
////            System.out.println("IDPieza: "+IDpieza + " FORMA TALON: "+formatalon);
//            if(formabasez.equals("LsP-Lasca primaria o cortical")){
//                
//            
//            if(tamaño.equals(tbl2.getValueAt(j, 0).toString())){
//                
//                pieza = new DefaultMutableTreeNode(IDpieza);
//                hoja = new DefaultMutableTreeNode("Gen-"+IDutiles[0]+"/"+IDutiles[1]);
//                pieza.add(hoja);
//                
//                for (int k = 0; k < estandar.size(); k++) {
//                    int [] IDestandar = new int[2];
//                     IDestandar = estandar.get(k);
//                    if(IDpieza==IDestandar[1]){
//                    hoja = new DefaultMutableTreeNode("Seg"+"-"+IDestandar[0]+"/Pieza-"+IDestandar[1]);
//                    pieza.add(hoja);
//                      }
//                      }
//                for (int m = 0; m < puntas.size(); m++) {
//                    int [] IDpuntas = new int[2];
//                     IDpuntas = puntas.get(m);
//                    
//                     if(IDpieza==IDpuntas[1]){
//                    hoja = new DefaultMutableTreeNode("PP"+"-"+IDpuntas[0]+"/Pieza-"+IDpuntas[1]);
//                    pieza.add(hoja);
//                    }
//                      }
//             
//           
//           
//         switch(tbl2.getValueAt(j, 0).toString()){
//             case "1":hoja_tamaño1p.add(pieza);
//             break;
//             case "2":hoja_tamaño2p.add(pieza);
//             break;
//             case "3":hoja_tamaño3p.add(pieza);
//             break;
//             case "4":hoja_tamaño4p.add(pieza);
//             break;
//             
//         }
//    }
//            
//          
//    }
// 
//                       if(formabasez.equals("LsS-Lasca secundaria o de descortezamiento")){
//                
//            
//            if(tamaño.equals(tbl2.getValueAt(j, 0).toString())){
//                
//                pieza = new DefaultMutableTreeNode(IDpieza);
//                hoja = new DefaultMutableTreeNode("Gen-"+IDutiles[0]+"/"+IDutiles[1]);
//                pieza.add(hoja);
//                
//                for (int k = 0; k < estandar.size(); k++) {
//                    int [] IDestandar = new int[2];
//                     IDestandar = estandar.get(k);
//                    if(IDpieza==IDestandar[1]){
//                    hoja = new DefaultMutableTreeNode("Seg"+"-"+IDestandar[0]+"/Pieza-"+IDestandar[1]);
//                    pieza.add(hoja);
//                      }
//                      }
//                for (int m = 0; m < puntas.size(); m++) {
//                    int [] IDpuntas = new int[2];
//                     IDpuntas = puntas.get(m);
//                    
//                     if(IDpieza==IDpuntas[1]){
//                    hoja = new DefaultMutableTreeNode("PP"+"-"+IDpuntas[0]+"/Pieza-"+IDpuntas[1]);
//                    pieza.add(hoja);
//                    }
//                      }
//             
//           
//           
//         switch(tbl2.getValueAt(j, 0).toString()){
//             case "1":hoja_tamaño1s.add(pieza);
//             break;
//             case "2":hoja_tamaño2s.add(pieza);
//             break;
//             case "3":hoja_tamaño3s.add(pieza);
//             break;
//             case "4":hoja_tamaño4s.add(pieza);
//             break;
//             
//         }
//    }
//            
//          
//    }
//            
//    }
//    }
//                
//       
//        
//        
//        
//        
//        
//                hoja_lsprim.add(hoja_tamaño1p);  
//                hoja_lsprim.add(hoja_tamaño2p);  
//                hoja_lsprim.add(hoja_tamaño3p);  
//                hoja_lsprim.add(hoja_tamaño4p);  
//        
//                hoja_lssec.add(hoja_tamaño1s);  
//                hoja_lssec.add(hoja_tamaño2s);  
//                hoja_lssec.add(hoja_tamaño3s);  
//                hoja_lssec.add(hoja_tamaño4s);  
//                hoja_utiles.add(hoja_lsprim);  
//                hoja_utiles.add(hoja_lssec);  
//                
//                
//                root.add(hoja_utiles);
//                root.setUserObject(txt_muestra.getText()+"/ "+txt_mp_selec.getText());
//                tree1.setModel(model);
//                model.reload();
//
//



/////////////////////////////////////DESECHOS DE TALLA////////////////////////////////
//
//       calc.cargarArbolCriterioDTf(tree2, "DT_CONTALON2 f", "TAMAÑO 1:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='1')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");
//       calc.cargarArbolCriterioDTf(tree2, "DT_CONTALON2 f", "TAMAÑO 2:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='2')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");
//       calc.cargarArbolCriterioDTf(tree2, "DT_CONTALON2 f", "TAMAÑO 3:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='3')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");
//       calc.cargarArbolCriterioDTf(tree2, "DT_CONTALON2 f", "TAMAÑO 4:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ "AND (f.ORIGEN_EXTRACCION='6-Ls. Externa') AND (f.TAMAÑO='4')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"/ LS.EXTERNAS");
//
//
//

}


    private void btn_copiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiarActionPerformed
                Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl, txt_muestra.getText(), txt_sentencia.getText(), "Forma de la plataforma en núcleos y en talón de útiles", "Materia prima: "+txt_mp_selec.getText());
    
    }//GEN-LAST:event_btn_copiarActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
 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_jButton1ActionPerformed

    private void btn_info1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_info1ActionPerformed
String analisis = "TABLA 1. LASCAS PRIMARIAS Y SECUNDARIAS SEGÚN TAMAÑO EN FORMAS-BASE DE ÚTILES:\n" +
"\n" +
"Útiles = artefactos formatizados + PNRC + FNRC. \n" +
"\n" +
"Sobre útiles se contabiliza en las fichas generales todas las Lascas primarias (o corticales) y las secundarias (o de descortezamiento). \n" +
"Se distribuyen según tamaños. No se contabilizan aquellas cuyo tamaño es CN o N.D.\n" +
"\n" +
"INDICE DE CORTICALIDAD EN UTILES = (total de lascas primarias y secundarias de útiles) x 100 / (total de útiles).\n" +
"\n" +
"\n" +
"TABLA 2. PROPORCION DE CORTEZA EN ÚTILES.\n" +
"\n" +
"Se distribuyen los útiles de acuerdo a la reserva de corteza que se haya ingresado en la ficha general. \n" +
"\n" +
"TABLA 3. LASCAS EXTERNAS SEGÚN TAMAÑOS, EN DESECHOS DE TALLA (ENTEROS Y FRACTURADOS CON TALÓN)\n" +
"\n" +
"Se distribuyen todas las lascas externas de Desechos de talla enteros y fracturados con talón, de acuerdo a sus tamaños. No se contabilitan tamaños registrados como CN o N.D.\n" +
"\n" +
"INDICE DE CORTICALIDAD EN DT. ENT.Y FRAC. CON TALON= (total de lascas externas en DT ent. y frac. CT) x 100 / (total de DT ent. y fract CT).\n" +
"\n" +
"TABLA 4. PROPORCION DE CORTEZA EN DESECHOS DE TALLA.\n" +
"\n" +
"Se distribuyen los desechos de talla enteros y fracturados con talón, junto con los fracturados sin talón, de acuerdo a la reserva de corteza que se haya ingresado en las fichas ";

       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(analisis);

    }//GEN-LAST:event_btn_info1ActionPerformed

    private void btn_arbol1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_arbol1ActionPerformed
//          Arbol ar = new Arbol();
//        ar.setVisible(true);
//        arboltbl2(txt_sentencia.getText(), txt_mp_selec.getText(),ar.arbol_analisis_FORM, ar.arbol_analisisDT);
//ar.txt_mp.setText(txt_mp_selec.getText());
//        ar.txt_nota.setText("");
arbol_2_alternativo();
    }//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(tbl2, txt_muestra.getText(), txt_sentencia.getText(), "Lascas primarias y secundarias, según tamaño, en formas base - útiles", "Materia prima: "+txt_mp_selec.getText());
    
    }//GEN-LAST:event_btn_copiar1ActionPerformed

    private void btn_info2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_info2ActionPerformed
String analisis = "LAMINARIDAD SOBRE LASCAS Y HOJAS "
        + "\nContabiliza útiles y desechos de talla enteros y fracturados con talón en base a:\n" +
"\n" +
"lascas y hojas y a módulos laminares (bagolini).\n" +
"\n" +
"\n" +
"*******UTILES: formatizados + pnrc + fnrc\n" +
"\n" +
"-LASCAS EN UTILES:\n" +
"en forma base los siguientes atributos:\n" +
"\n" +
"LsP-Lasca primaria o cortical\n" +
"LsS-Lasca secundaria o de descortezamiento\n" +
"LsDN-Lasca con dorso natural(gajo)\n" +
"LsAng-Lasca angular\n" +
"LsAr-Lasca de arista\n" +
"LsPl-Lasca plana\n" +
"LsCta-Lasca en cresta\n" +
"LsFNu-Lasca de flanco de núcleo\n" +
"LsTNu-Lasca de tableta de núcleo\n" +
"LsST-Lasca de semitableta de núcleo\n" +
"LsBp.Lasca bipolar (doble bulbo de percusión)\n" +
"LsND-Lasca no diferenciada\n" +
"LsRc-Lasca reciclada\n" +
"\n" +
"-HOJAS EN UTILES:\n" +
"en forma base los siguientes atributos:\n" +
"HoArS-Hoja de arista simple\n" +
"HoArM-Hoja de arista doble o múltiple\n" +
"HoND-Hoja no diferenciada\n" +
"HoRc-Hoja reciclada\n" +
"\n" +
"*******DESECHOS DE TALLA ENTEROS Y FRAC. CON TALÓN:\n" +
"\n" +
"-LASCAS EN DT CT:\n" +
"en Forma Base de lasca/hoja, los siguientes atributos:\n" +
"\n" +

"LsP-Lasca primaria o cortical\n" +
"LsS-Lasca secundaria o de descortezamiento\n" +
"LsDN-Lasca con dorso natural(gajo)\n" +
"LsAng-Lasca angular\n" +
"LsAr-Lasca de arista\n" +
"LsPl-Lasca plana\n" +
"LsCta-Lasca en cresta\n" +
"LsFNu-Lasca de flanco de núcleo\n" +
"LsTNu-Lasca de tableta de núcleo\n" +
"LsST-Lasca de semitableta de núcleo\n" +
"LsBp.Lasca bipolar (doble bulbo de percusión)\n" +
"LsND-Lasca no diferenciada\n" +
"\n" +
"-HOJAS EN DT CT:\n" +
"en Forma Base de lasca/hoja, los siguientes atributos:\n" +
"\n" +
"HoArS-Hoja de arista simple\n" +
"HoArM-Hoja de arista doble o múltiple\n" +
"HoND-Hoja no diferenciada\n" +
"\n" +
"******LAMINARIDAD:\n" +
"Los valores se distribuyen según los módulos laminares de Bagolini (A, B, y C.)\n" +
"";
       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(analisis);

    }//GEN-LAST:event_btn_info2ActionPerformed

    private void btn_arbol2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_arbol2ActionPerformed
arboltbl3();
    }//GEN-LAST:event_btn_arbol2ActionPerformed
public void arboltbl3(){
Arbol ar = new Arbol();
ar.setVisible(true);
 ar.txt_mp.setText(txt_mp_selec.getText());
 
DefaultTreeModel model = (DefaultTreeModel) ar.arbol_analisis_FORM.getModel();        
DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot();
    
String sentencia = txt_sentencia.getText();
String matprim = txt_mp_selec.getText();
CalculosBD calc=new CalculosBD();
String ids= calc.obteneridutiles(txt_sentencia.getText(), txt_mp_selec.getText());

    DiseñoArbol d = new DiseñoArbol(txt_sentencia.getText(), txt_mp_selec.getText());
 

   String Utiles_HOJAS_ModA =     "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      sentencia + " AND (f.MP='"+matprim+"')"+  ids + " AND (f.MODULO_LONG_ANCHO='A') "+ hojasutiles;
             
    ArrayList<Integer> ids_arbol = solicitarids(Utiles_HOJAS_ModA);

    DefaultMutableTreeNode hoja_categoriaA = d.armarcarpetaconpiezas(ids_arbol, "Hojas en útiles MOD A");
    root.add(hoja_categoriaA);
    
    ///////////////////////////////////////////////////////////////
   String Utiles_HOJAS_ModB =     "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      sentencia + " AND (f.MP='"+matprim+"')"+  ids + " AND (f.MODULO_LONG_ANCHO='B') "+ hojasutiles;
             
    ids_arbol = solicitarids(Utiles_HOJAS_ModB);

    DefaultMutableTreeNode hoja_categoriaB = d.armarcarpetaconpiezas(ids_arbol, "Hojas en útiles MOD B");
    root.add(hoja_categoriaB);
    ///////////////////////////////////////////////////////////////
   String Utiles_HOJAS_ModC =     "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      sentencia + " AND (f.MP='"+matprim+"')"+  ids + " AND (f.MODULO_LONG_ANCHO='C') "+ hojasutiles;
             
    ids_arbol = solicitarids(Utiles_HOJAS_ModC);

    DefaultMutableTreeNode hoja_categoriaC = d.armarcarpetaconpiezas(ids_arbol, "Hojas en útiles MOD C");
    root.add(hoja_categoriaC);

    ///////////////////////////////////////////////////////////////
   String Utiles_Lascas_ModA =     "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      sentencia + " AND (f.MP='"+matprim+"')"+  ids + " AND (f.MODULO_LONG_ANCHO='A') "+ lascasutiles;
             
    ids_arbol = solicitarids(Utiles_Lascas_ModA);

    DefaultMutableTreeNode hoja_cat_AA = d.armarcarpetaconpiezas(ids_arbol, "Lascas en útiles MOD A");
    root.add(hoja_cat_AA);
 ///////////////////////////////////////////////////////////////
    String Utiles_Lascas_ModB =     "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      sentencia + " AND (f.MP='"+matprim+"')"+  ids + " AND (f.MODULO_LONG_ANCHO='B') "+ lascasutiles;
             
    ids_arbol = solicitarids(Utiles_Lascas_ModB);

    DefaultMutableTreeNode hoja_cat_BB = d.armarcarpetaconpiezas(ids_arbol, "Lascas en útiles MOD B");
    root.add(hoja_cat_BB);
 ///////////////////////////////////////////////////////////////
    String Utiles_Lascas_ModC =     "SELECT DISTINCT(f.ID_FORMATIZADOS) FROM FORMATIZADOS f "+
                      sentencia + " AND (f.MP='"+matprim+"')"+  ids + " AND (f.MODULO_LONG_ANCHO='C') "+ lascasutiles;
             
    ids_arbol = solicitarids(Utiles_Lascas_ModC);

    DefaultMutableTreeNode hoja_cat_CC = d.armarcarpetaconpiezas(ids_arbol, "Lascas en útiles MOD C");
    root.add(hoja_cat_CC);
    
    
    

    
    root.setUserObject(txt_muestra.getText()+"/ "+txt_mp_selec.getText());
    ar.arbol_analisis_FORM.setModel(model);
    model.reload();
    
    
    
    
    ///////////ARBOL DT
           calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "LASCAS MOD A:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ lascasDT+ " AND (f.MODULO_LONG_ANCHO='A')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"Lascas y hojas");
           calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "LASCAS MOD B:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ lascasDT+ " AND (f.MODULO_LONG_ANCHO='B')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"Lascas y hojas");
           calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "LASCAS MOD C:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ lascasDT+ " AND (f.MODULO_LONG_ANCHO='C')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"Lascas y hojas");
           calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "HOJAS MOD A:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ hojasdt+ " AND (f.MODULO_LONG_ANCHO='A')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"Lascas y hojas");
           calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "HOJAS MOD B:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ hojasdt+ " AND (f.MODULO_LONG_ANCHO='B')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"Lascas y hojas");
           calc.cargarArbolCriterioDTf(ar.arbol_analisisDT, "DT_CONTALON2 f", "HOJAS MOD C:", "f.ID_DT_CONTALON", "ID_DT_CONTALON", "f.PIEZA", "PIEZA", "CT-", txt_sentencia.getText()+ hojasdt+ " AND (f.MODULO_LONG_ANCHO='C')", txt_muestra.getText()+"/"+txt_mp_selec.getText()+"Lascas y hojas");
 


}
private ArrayList<Integer> solicitarids(String sentencia){
  ArrayList<Integer> forms = new ArrayList<>();  
       ResultSet rs = null;
    
             try {
            conexion c = new conexion();
            c.getConexion();
            
             rs = c.consulta(sentencia);
         
             
               while(rs.next()){
                int utiles_aux=rs.getInt("ID_FORMATIZADOS");
                forms.add(utiles_aux);
               
           }       
        
        c.closeconnection();
 } catch (SQLException ex) {
            Logger.getLogger(InteraccionesBD.class.getName()).log(Level.SEVERE, null, ex);
        }
             return forms;
}
    private void btn_copiar2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar2ActionPerformed
                 Copiartabla copy = new Copiartabla();
                copy.copiartabla(tbl4, txt_muestra.getText(), txt_sentencia.getText(), "Laminaridad sobre lascas y hojas, en útiles y DT", "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
String analisis = "Se calculan los siguientes valores para la muestra y la materia prima seleccionada:\n" +
"\n" +
"----N UTILES= total de formatizados + PNRC + FNRC\n" +
"N Desechos de Talla enteros y fracturados con talón. \n" +
"\n" +
"----N HOJAS EN ÚTILES= cantidad de útiles que presentan formas base de hojas. \n" +
"\n" +
"----N LASCAS EN ÚTILES= cantidad de útiles que presentan formas base de lascas.\n" +
"\n" +
"----N HOJAS EN DT CT= cantidad de DT CT que presentan formas base de hojas. \n" +
"\n" +
"----N LASCAS EN DT CT= cantidad de DT CT que presentan formas base de lascas.\n" +
"\n" +
"----N NUCLEOS AGOTADOS\n" +
"\n" +
"\n" +
"\n" +
"----PORCENTAJE DE HOJAS EN ÚTILES = (N HOJAS EN UTILES X 100 / N ÚTILES)\n" +
"\n" +
"----PORCENTAJE DE LASCAS EN ÚTILES = (N LASCAS EN UTILES X 100 / N ÚTILES)\n" +
"\n" +
"----PORCENTAJE DE HOJAS EN DT CT= (N HOJAS EN DT CT X 100 / N DT CT)\n" +
"\n" +
"----PORCENTAJE DE LASCAS EN DT CT= (N LASCAS EN DT CT X 100 / N DT CT)";
       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(analisis);

        

    }//GEN-LAST:event_btn_info3ActionPerformed

    private void btn_copiar3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar3ActionPerformed
  Copiartabla copy = new Copiartabla();
   copy.copiarsolotexto(txt_muestra.getText(),txt_sentencia.getText(), "HOJAS Y LASCAS EN DT Y EN UTILES",
           "\n N°UTILES: "+txt_n_utiles2.getText()
           +"\n N°DT: "+txt_n_dt2.getText()
           +"\n N°NUCLEOS AGOTADOS: "+txt_n_nucleosagotados.getText()
           +"\n "
           +"\n N HOJAS EN UTILES: \t"+txt_n_hojasenutiles.getText() +"\t % HOJAS EN ÚTILES: \t" + txt_porc_hojasUtiles.getText()
           +"\n N LASCAS EN UTILES: \t"+txt_n_lascasenutiles.getText() +"\t % LASCAS EN ÚTILES: \t"+txt_porc_lascasUtiles.getText()
          +"\n N HOJAS EN DT: \t"+txt_n_hojasendt.getText() +"\t % HOJAS EN DT: \t" + txt_porc_hojasDT.getText()   
           
           +"\n N LASCAS EN DT: \t"+txt_n_lascasendt.getText()+"\t % LASCAS EN ÚTILES: \t" + txt_porc_lascasDT.getText()
                
   );

    }//GEN-LAST:event_btn_copiar3ActionPerformed

    private void tbl8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl8MouseClicked
 int columnaselec= tbl8.getSelectedColumn();
int col = tbl8.getColumnCount()-1;
        
        if((columnaselec>0)&&(columnaselec<col)){
              
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl8, jpanel10, tbl8.getColumnName(columnaselec), "Corteza reservada");
            
        }
    }//GEN-LAST:event_tbl8MouseClicked

    private void tbl9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl9MouseClicked
        int filaselec = tbl9.getSelectedRow();
        int filas = tbl9.getRowCount()-1;
        
        if(filaselec<filas){
             if(fila8.isSelected()==true){

            
        Graficos graf = new Graficos();
        graf.generargraficofila2(tbl9, jpanel11, tbl9.getValueAt(filaselec,0).toString(), "DT Ent y fract. CT y ST");
            
        } }
        
        int col=tbl9.getColumnCount()-1;
        int columnaselec = tbl9.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
              if(columna8.isSelected()==true){
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl9, jpanel11, tbl9.getColumnName(columnaselec), "Reserva de corteza");
            
        }}
    }//GEN-LAST:event_tbl9MouseClicked

    private void tbl4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbl4MouseClicked
               int filaselec = tbl4.getSelectedRow();
        int filas = tbl4.getRowCount()-1;
        
        if(filaselec<filas){
             if(fila3.isSelected()==true){

            
        Graficos graf = new Graficos();
        graf.generargraficofila2(tbl4, jpanel3, tbl4.getValueAt(filaselec,0).toString(), "Útiles o DT ent. y frac.CT");
            
        } }
        
        int col=tbl4.getColumnCount()-1;
        int columnaselec = tbl4.getSelectedColumn();
        if((columnaselec>0)&&(columnaselec<col)){
              if(columna3.isSelected()==true){
                         
            Graficos graf = new Graficos();
            graf.generargraficocolumna(tbl4, jpanel3, tbl4.getColumnName(columnaselec), "Mód. laminares (Bagolini");
            
        }}
    }//GEN-LAST:event_tbl4MouseClicked

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

    private void btn_copiar4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar4ActionPerformed
  Copiartabla copy = new Copiartabla();
   copy.copiartabla(tbl8, txt_muestra.getText(), txt_sentencia.getText(), 
    "Proporción de corteza en útiles",
    "Materia prima: "+txt_mp_selec.getText());
    
    }//GEN-LAST:event_btn_copiar4ActionPerformed

    private void btn_copiar5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_copiar5ActionPerformed
   Copiartabla copy = new Copiartabla();
   copy.copiartabla(tbl3, txt_muestra.getText(), txt_sentencia.getText(), 
    "Lascas externas según tamaño 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(tbl9, txt_muestra.getText(), txt_sentencia.getText(), 
    "Proporción de corteza en DT",
    "Materia prima: "+txt_mp_selec.getText());
    }//GEN-LAST:event_btn_copiar6ActionPerformed
private String concatenarformaplataformanucleos(){
    String forma = "";
    int filas = tbl.getRowCount()-1;
    
    if(filas==1){
        forma = "AND (n.PLAT_FORMA_SUP='"+tbl.getValueAt(0, 0).toString()+"') "; 
    }else{
    for (int i = 0; i < filas; i++) {
      if(i==0){
          forma = "AND ( n.PLAT_FORMA_SUP='"+tbl.getValueAt(i, 0).toString()+"' ";
      }else{
          if(i==filas-1){
              forma = forma + "OR n.PLAT_FORMA_SUP='"+tbl.getValueAt(i, 0).toString()+"') ";
          }else{
              forma= forma + "OR n.PLAT_FORMA_SUP='"+tbl.getValueAt(i, 0).toString()+"' ";
          }
      }  
        
    }
        
    }
    
    
    return forma;
}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup botones1;
    private javax.swing.ButtonGroup botones2;
    private javax.swing.ButtonGroup botones3;
    private javax.swing.ButtonGroup botones4;
    private javax.swing.JButton btn_arbol;
    private javax.swing.JButton btn_arbol1;
    private javax.swing.JButton btn_arbol2;
    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_info;
    private javax.swing.JButton btn_info1;
    private javax.swing.JButton btn_info2;
    private javax.swing.JButton btn_info3;
    private javax.swing.JComboBox<String> cbx_mp;
    private javax.swing.JRadioButton columna;
    private javax.swing.JRadioButton columna2;
    private javax.swing.JRadioButton columna3;
    private javax.swing.JRadioButton columna4;
    private javax.swing.JRadioButton columna5;
    private javax.swing.JRadioButton columna6;
    private javax.swing.JRadioButton columna7;
    private javax.swing.JRadioButton columna8;
    private javax.swing.JRadioButton fila;
    private javax.swing.JRadioButton fila2;
    private javax.swing.JRadioButton fila3;
    private javax.swing.JRadioButton fila4;
    private javax.swing.JRadioButton fila5;
    private javax.swing.JRadioButton fila6;
    private javax.swing.JRadioButton fila7;
    private javax.swing.JRadioButton fila8;
    private javax.swing.JButton jButton1;
    private javax.swing.JComboBox<String> jComboBox2;
    private javax.swing.JInternalFrame jInternalFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel34;
    private javax.swing.JLabel jLabel35;
    private javax.swing.JLabel jLabel36;
    private javax.swing.JLabel jLabel37;
    private javax.swing.JLabel jLabel38;
    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 jPanel10;
    private javax.swing.JPanel jPanel11;
    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.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    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 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.JTextField jTextField1;
    private javax.swing.JTextField jTextField14;
    private javax.swing.JTextField jTextField15;
    private javax.swing.JTextField jTextField16;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField8;
    private javax.swing.JTextField jTextField9;
    private javax.swing.JPanel jpanel;
    private javax.swing.JPanel jpanel1;
    private javax.swing.JPanel jpanel10;
    private javax.swing.JPanel jpanel11;
    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.JPanel jpanel8;
    private javax.swing.JPanel jpanel9;
    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 tbl5;
    private javax.swing.JTable tbl6;
    private javax.swing.JTable tbl7;
    private javax.swing.JTable tbl8;
    private javax.swing.JTable tbl9;
    private javax.swing.JTextField txt_DT_lsext;
    private javax.swing.JTextField txt_indice_cor_DT;
    private javax.swing.JTextField txt_indice_corticalidad_utiles;
    private javax.swing.JTextField txt_mp_selec;
    private javax.swing.JTextField txt_muestra;
    private javax.swing.JTextField txt_n_dt;
    private javax.swing.JTextField txt_n_dt2;
    private javax.swing.JTextField txt_n_hojasendt;
    private javax.swing.JTextField txt_n_hojasenutiles;
    private javax.swing.JTextField txt_n_lascasendt;
    private javax.swing.JTextField txt_n_lascasenutiles;
    private javax.swing.JTextField txt_n_lsprimsec;
    private javax.swing.JTextField txt_n_nucleosagotados;
    private javax.swing.JTextField txt_n_utiles;
    private javax.swing.JTextField txt_n_utiles2;
    private javax.swing.JTextField txt_porc_hojasDT;
    private javax.swing.JTextField txt_porc_hojasUtiles;
    private javax.swing.JTextField txt_porc_lascasDT;
    private javax.swing.JTextField txt_porc_lascasUtiles;
    private javax.swing.JTextField txt_sentencia;
    // End of variables declaration//GEN-END:variables
}
