br.com.atmatech.sac.view.ViewPessoa.java Source code

Java tutorial

Introduction

Here is the source code for br.com.atmatech.sac.view.ViewPessoa.java

Source

    /*
     * 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 br.com.atmatech.sac.view;

    import br.com.atmatech.sac.beans.AnexoBeans;
    import br.com.atmatech.sac.beans.DBConfigBeans;
    import br.com.atmatech.sac.beans.DistritoBeans;
    import br.com.atmatech.sac.beans.ModuloBeans;
    import br.com.atmatech.sac.beans.PessoaBeans;
    import br.com.atmatech.sac.beans.SituacaoBeans;
    import br.com.atmatech.sac.beans.UsuarioLogadoBeans;
    import br.com.atmatech.sac.controller.Email;
    import br.com.atmatech.sac.controller.NivelAcesso;
    import br.com.atmatech.sac.dao.AnexoDao;
    import br.com.atmatech.sac.dao.DistritoDao;
    import br.com.atmatech.sac.dao.ModuloDao;
    import br.com.atmatech.sac.dao.PessoaDao;
    import br.com.atmatech.sac.dao.SituacaoDao;
    import br.com.atmatech.sac.webService.WebServiceAtivacao;
    import br.com.atmatech.sac.webService.WebServiceCadastro;
    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.net.MalformedURLException;
    import java.sql.Date;
    import java.sql.SQLException;
    import java.util.List;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import javax.swing.ActionMap;
    import javax.swing.InputMap;
    import javax.swing.JComponent;
    import javax.swing.JEditorPane;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.KeyStroke;
    import javax.swing.table.DefaultTableModel;
    import org.apache.commons.mail.EmailException;

    /**
     *
     * @author MARCOS
     */
    public class ViewPessoa extends javax.swing.JPanel {

        /**
         * Creates new form ViewPessoa
         */
        List<ModuloBeans> mb;
        List<SituacaoBeans> lsb;
        List<DistritoBeans> ldb;
        List<PessoaBeans> lpb;
        List<AnexoBeans> lab;
        JPanel TempViewPessoa = this;
        boolean inicializatela = false;

        public ViewPessoa() {
            initComponents();
            // buscaDistrito();
            desativaColunas();
            // jTiddistrito.setVisible(false);
            jTidpessoa.setVisible(false);
            jTiddistrito.setVisible(false);
            jBfinanceiro.setVisible(false);
            // buscaPessoa();
            permissaoUsuario();
            jDaguarde.setUndecorated(true);
            inicializaAtalhos();
            this.inicializatela = true;
        }

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

        jDcidade = new javax.swing.JDialog();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTtcidade = new javax.swing.JTable();
        jTconsulta = new javax.swing.JTextField();
        jLindice = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMativacao = new javax.swing.JMenu();
        jMativa = new javax.swing.JMenuItem();
        jMArquivo = new javax.swing.JMenu();
        jMcarregararquivo = new javax.swing.JMenuItem();
        jMexportararquivo = new javax.swing.JMenuItem();
        jMemail = new javax.swing.JMenuItem();
        jDfilechoose = new javax.swing.JDialog();
        jFileChooser2 = new javax.swing.JFileChooser();
        jDarquivo = new javax.swing.JDialog();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTtanexo = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jLabel16 = new javax.swing.JLabel();
        jDchave = new javax.swing.JDialog();
        jTdchave = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jDaguarde = new javax.swing.JDialog();
        jPanel6 = new javax.swing.JPanel();
        jLabel21 = new javax.swing.JLabel();
        JDwebFinanceiro = new javax.swing.JDialog();
        jScrollPane5 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();
        jDemail = new javax.swing.JDialog();
        jPanel4 = new javax.swing.JPanel();
        jLabel22 = new javax.swing.JLabel();
        jTassunto = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane6 = new javax.swing.JScrollPane();
        jTPconteudo = new javax.swing.JTextPane();
        jBemailmassa = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTtempresa = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        jBnovo = new javax.swing.JButton();
        jBsalvar = new javax.swing.JButton();
        jBalterar = new javax.swing.JButton();
        jBexcluir = new javax.swing.JButton();
        jBcancelar = new javax.swing.JButton();
        jBopcao = new javax.swing.JButton();
        jBfinanceiro = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTrazao = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jTfantasia = new javax.swing.JTextField();
        jFcnpj = new javax.swing.JFormattedTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jTinscrio = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jFtelefone1 = new javax.swing.JFormattedTextField();
        jLabel6 = new javax.swing.JLabel();
        jFtelefone2 = new javax.swing.JFormattedTextField();
        jLabel7 = new javax.swing.JLabel();
        jFtelefone3 = new javax.swing.JFormattedTextField();
        jLabel8 = new javax.swing.JLabel();
        jTendereco = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jTnumero = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTcidade = new javax.swing.JTextField();
        jBcidade = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jCsituacao = new javax.swing.JComboBox();
        jLabel12 = new javax.swing.JLabel();
        jTemail = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTobs = new javax.swing.JTextArea();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jTbairro = new javax.swing.JTextField();
        jTiddistrito = new javax.swing.JTextField();
        jTidpessoa = new javax.swing.JTextField();
        jBcadcnpj = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        jTresponsavel = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel13 = new javax.swing.JLabel();
        jCmodulo = new javax.swing.JComboBox();
        jCnfe = new javax.swing.JCheckBox();
        jCecf = new javax.swing.JCheckBox();
        jLabel20 = new javax.swing.JLabel();
        jDplugins = new com.toedter.calendar.JDateChooser();
        jCnfce = new javax.swing.JCheckBox();
        jScrollPane7 = new javax.swing.JScrollPane();
        jTobsatend = new javax.swing.JTextArea();
        jLabel24 = new javax.swing.JLabel();

        jDcidade.setTitle("Cidade");
        jDcidade.setMinimumSize(new java.awt.Dimension(635, 270));
        jDcidade.setModal(true);
        jDcidade.setResizable(false);

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

            },
            new String [] {
                "IDDISTRITO", "DISTRITO", "MUNICIPIO", "UF", "PAIS"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTtcidade.getTableHeader().setResizingAllowed(false);
        jTtcidade.getTableHeader().setReorderingAllowed(false);
        jTtcidade.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTtcidadeMouseClicked(evt);
            }
        });
        jTtcidade.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTtcidadeKeyPressed(evt);
            }
        });
        jScrollPane2.setViewportView(jTtcidade);
        if (jTtcidade.getColumnModel().getColumnCount() > 0) {
            jTtcidade.getColumnModel().getColumn(0).setResizable(false);
            jTtcidade.getColumnModel().getColumn(1).setResizable(false);
            jTtcidade.getColumnModel().getColumn(2).setResizable(false);
            jTtcidade.getColumnModel().getColumn(3).setResizable(false);
            jTtcidade.getColumnModel().getColumn(4).setResizable(false);
        }

        jTconsulta.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(100,true));
        jTconsulta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTconsultaActionPerformed(evt);
            }
        });
        jTconsulta.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTconsultaKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTconsultaKeyReleased(evt);
            }
        });

        jLabel23.setForeground(new java.awt.Color(204, 0, 0));
        jLabel23.setText("F12 SELECIONA REGISTRO");

        javax.swing.GroupLayout jDcidadeLayout = new javax.swing.GroupLayout(jDcidade.getContentPane());
        jDcidade.getContentPane().setLayout(jDcidadeLayout);
        jDcidadeLayout.setHorizontalGroup(
            jDcidadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDcidadeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jDcidadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE)
                    .addComponent(jTconsulta)
                    .addGroup(jDcidadeLayout.createSequentialGroup()
                        .addComponent(jLindice, javax.swing.GroupLayout.PREFERRED_SIZE, 133, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel23)))
                .addContainerGap())
        );
        jDcidadeLayout.setVerticalGroup(
            jDcidadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDcidadeLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jDcidadeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLindice, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTconsulta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(35, Short.MAX_VALUE))
        );

        jDcidade.getAccessibleContext().setAccessibleParent(null);

        jMativacao.setText("Ativao");

        jMativa.setText("Ativao");
        jMativa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMativaActionPerformed(evt);
            }
        });
        jMativacao.add(jMativa);

        jPopupMenu1.add(jMativacao);

        jMArquivo.setText("Arquivo");

        jMcarregararquivo.setText("Carregar Arquivo");
        jMcarregararquivo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMcarregararquivoMouseClicked(evt);
            }
        });
        jMcarregararquivo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMcarregararquivoActionPerformed(evt);
            }
        });
        jMArquivo.add(jMcarregararquivo);

        jMexportararquivo.setText("Exportar Arquivo");
        jMexportararquivo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMexportararquivoActionPerformed(evt);
            }
        });
        jMArquivo.add(jMexportararquivo);

        jPopupMenu1.add(jMArquivo);

        jMemail.setText("Email");
        jMemail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMemailActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMemail);

        jDfilechoose.setTitle("Arquivo");
        jDfilechoose.setMinimumSize(new java.awt.Dimension(638, 329));
        jDfilechoose.setModal(true);

        jFileChooser2.setDialogTitle("");
        jFileChooser2.setToolTipText("");
        jFileChooser2.setName(""); // NOI18N
        jFileChooser2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jFileChooser2MouseClicked(evt);
            }
        });
        jFileChooser2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jFileChooser2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jDfilechooseLayout = new javax.swing.GroupLayout(jDfilechoose.getContentPane());
        jDfilechoose.getContentPane().setLayout(jDfilechooseLayout);
        jDfilechooseLayout.setHorizontalGroup(
            jDfilechooseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jDfilechooseLayout.createSequentialGroup()
                .addContainerGap(14, Short.MAX_VALUE)
                .addComponent(jFileChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jDfilechooseLayout.setVerticalGroup(
            jDfilechooseLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDfilechooseLayout.createSequentialGroup()
                .addComponent(jFileChooser2, javax.swing.GroupLayout.PREFERRED_SIZE, 294, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 181, Short.MAX_VALUE))
        );

        jDarquivo.setTitle("Exportar");
        jDarquivo.setMinimumSize(new java.awt.Dimension(400, 273));
        jDarquivo.setModal(true);
        jDarquivo.setResizable(false);

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

            },
            new String [] {
                "idanexo", "Exportar", "Descrio", "Data"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Boolean.class, java.lang.Object.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, false, false
            };

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

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTtanexo.getTableHeader().setReorderingAllowed(false);
        jScrollPane4.setViewportView(jTtanexo);
        if (jTtanexo.getColumnModel().getColumnCount() > 0) {
            jTtanexo.getColumnModel().getColumn(0).setResizable(false);
        }

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Snapforward.png"))); // NOI18N
        jButton1.setText("Exportar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jDarquivoLayout = new javax.swing.GroupLayout(jDarquivo.getContentPane());
        jDarquivo.getContentPane().setLayout(jDarquivoLayout);
        jDarquivoLayout.setHorizontalGroup(
            jDarquivoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDarquivoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jDarquivoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
                    .addComponent(jButton1))
                .addGap(15, 15, 15))
        );
        jDarquivoLayout.setVerticalGroup(
            jDarquivoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jDarquivoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton1)
                .addContainerGap())
        );

        jLabel16.setText("jLabel16");

        jDchave.setTitle("Ativao");
        jDchave.setMinimumSize(new java.awt.Dimension(344, 95));
        jDchave.setModal(true);
        jDchave.setResizable(false);

        jTdchave.setEditable(false);

        jLabel17.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Attention.png"))); // NOI18N

        jLabel18.setText("Chave:");

        javax.swing.GroupLayout jDchaveLayout = new javax.swing.GroupLayout(jDchave.getContentPane());
        jDchave.getContentPane().setLayout(jDchaveLayout);
        jDchaveLayout.setHorizontalGroup(
            jDchaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDchaveLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jDchaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTdchave, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18))
                .addGap(38, 38, 38))
        );
        jDchaveLayout.setVerticalGroup(
            jDchaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jDchaveLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jDchaveLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jDchaveLayout.createSequentialGroup()
                        .addComponent(jLabel18)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTdchave, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(21, 21, 21))
        );

        jDaguarde.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        jDaguarde.setMinimumSize(new java.awt.Dimension(247, 90));
        jDaguarde.setModal(true);
        jDaguarde.setResizable(false);

        jPanel6.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jLabel21.setForeground(new java.awt.Color(255, 0, 0));
        jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel21.setText("AGUARDE....");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGap(38, 38, 38)
                .addComponent(jLabel21)
                .addContainerGap(34, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jDaguardeLayout = new javax.swing.GroupLayout(jDaguarde.getContentPane());
        jDaguarde.getContentPane().setLayout(jDaguardeLayout);
        jDaguardeLayout.setHorizontalGroup(
            jDaguardeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jDaguardeLayout.setVerticalGroup(
            jDaguardeLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        JDwebFinanceiro.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                JDwebFinanceiroWindowOpened(evt);
            }
        });

        jScrollPane5.setViewportView(jEditorPane1);

        javax.swing.GroupLayout JDwebFinanceiroLayout = new javax.swing.GroupLayout(JDwebFinanceiro.getContentPane());
        JDwebFinanceiro.getContentPane().setLayout(JDwebFinanceiroLayout);
        JDwebFinanceiroLayout.setHorizontalGroup(
            JDwebFinanceiroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JDwebFinanceiroLayout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 473, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(29, Short.MAX_VALUE))
        );
        JDwebFinanceiroLayout.setVerticalGroup(
            JDwebFinanceiroLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(JDwebFinanceiroLayout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(24, Short.MAX_VALUE))
        );

        jDemail.setMinimumSize(new java.awt.Dimension(620, 294));
        jDemail.setModal(true);
        jDemail.setResizable(false);

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Dados Email"));

        jLabel22.setText("Assunto:");

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Contedo"));

        jScrollPane6.setViewportView(jTPconteudo);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane6)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE)
        );

        jBemailmassa.setText("Enviar");
        jBemailmassa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBemailmassaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel22)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTassunto, javax.swing.GroupLayout.PREFERRED_SIZE, 432, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jBemailmassa)
                .addGap(0, 46, 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.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel22)
                        .addComponent(jTassunto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jBemailmassa, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(32, 32, 32)
                .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jDemailLayout = new javax.swing.GroupLayout(jDemail.getContentPane());
        jDemail.getContentPane().setLayout(jDemailLayout);
        jDemailLayout.setHorizontalGroup(
            jDemailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jDemailLayout.setVerticalGroup(
            jDemailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                formComponentShown(evt);
            }
        });

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

            },
            new String [] {
                "IDPESSOA", "RAZAO", "FANTASIA", "CNPJ", "ENDERECO"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTtempresa.getTableHeader().setReorderingAllowed(false);
        jTtempresa.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTtempresaMouseClicked(evt);
            }
        });
        jTtempresa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTtempresaKeyPressed(evt);
            }
        });
        jScrollPane1.setViewportView(jTtempresa);
        if (jTtempresa.getColumnModel().getColumnCount() > 0) {
            jTtempresa.getColumnModel().getColumn(0).setResizable(false);
        }

        jPanel1.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        jBnovo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Add.png"))); // NOI18N
        jBnovo.setText("F1-Novo");
        jBnovo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBnovoActionPerformed(evt);
            }
        });

        jBsalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Valid Blue.png"))); // NOI18N
        jBsalvar.setText("F2-Salvar");
        jBsalvar.setEnabled(false);
        jBsalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBsalvarActionPerformed(evt);
            }
        });

        jBalterar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Attention.png"))); // NOI18N
        jBalterar.setText("F3-Alterar");
        jBalterar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBalterarActionPerformed(evt);
            }
        });

        jBexcluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Remove Red.png"))); // NOI18N
        jBexcluir.setText("F4-Excluir");
        jBexcluir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBexcluirActionPerformed(evt);
            }
        });

        jBcancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Loop Off.png"))); // NOI18N
        jBcancelar.setText("Cancelar");
        jBcancelar.setEnabled(false);
        jBcancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBcancelarActionPerformed(evt);
            }
        });

        jBopcao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/atmatech/sac/icon/Knob Message.png"))); // NOI18N
        jBopcao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBopcaoActionPerformed(evt);
            }
        });

        jBfinanceiro.setText("Financeiro");
        jBfinanceiro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBfinanceiroActionPerformed(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()
                .addComponent(jBnovo)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jBsalvar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jBalterar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jBexcluir)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jBcancelar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jBopcao, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jBfinanceiro)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jBalterar, jBcancelar, jBexcluir, jBnovo, jBsalvar});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jBnovo)
                            .addComponent(jBsalvar)
                            .addComponent(jBalterar)
                            .addComponent(jBexcluir)
                            .addComponent(jBcancelar)))
                    .addComponent(jBopcao, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jBfinanceiro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jBalterar, jBcancelar, jBexcluir, jBnovo, jBsalvar});

        jLabel1.setForeground(new java.awt.Color(255, 102, 102));
        jLabel1.setText("Razo:");

        jTrazao.setEditable(false);
        jTrazao.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(80,true));
        jTrazao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTrazaoActionPerformed(evt);
            }
        });

        jLabel2.setText("Fantasia:");

        jTfantasia.setEditable(false);
        jTfantasia.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(80,true));

        jFcnpj.setEditable(false);
        jFcnpj.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(14,false));

        jLabel3.setForeground(new java.awt.Color(255, 102, 102));
        jLabel3.setText("CNPJ:");

        jLabel4.setText("Inscrio:");

        jTinscrio.setEditable(false);
        jTinscrio.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(20,false));

        jLabel5.setText("Telefone 1:");

        jFtelefone1.setEditable(false);
        jFtelefone1.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(10,false));

        jLabel6.setText("Telefone 2:");

        jFtelefone2.setEditable(false);
        jFtelefone2.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(10,false));

        jLabel7.setText("Telefone 3:");

        jFtelefone3.setEditable(false);
        jFtelefone3.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(10,false));

        jLabel8.setText("Endereo:");

        jTendereco.setEditable(false);
        jTendereco.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(80,true));
        jTendereco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTenderecoActionPerformed(evt);
            }
        });

        jLabel10.setText("Numero:");

        jTnumero.setEditable(false);
        jTnumero.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(10,true));
        jTnumero.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTnumeroActionPerformed(evt);
            }
        });

        jLabel9.setForeground(new java.awt.Color(255, 102, 102));
        jLabel9.setText("Cidade:");

        jTcidade.setEditable(false);
        jTcidade.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(200,true));
        jTcidade.setEnabled(false);
        jTcidade.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                jTcidadeFocusLost(evt);
            }
        });

        jBcidade.setText("...");
        jBcidade.setEnabled(false);
        jBcidade.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBcidadeActionPerformed(evt);
            }
        });

        jLabel11.setText("Situao");

        jCsituacao.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ativo", "Inativo", "Bloqueado" }));
        jCsituacao.setEnabled(false);

        jLabel12.setText("E-mail:");

        jTemail.setEditable(false);
        jTemail.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(80,true));

        jTobs.setEditable(false);
        jTobs.setColumns(20);
        jTobs.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(600,true));
        jTobs.setLineWrap(true);
        jTobs.setRows(5);
        jScrollPane3.setViewportView(jTobs);

        jLabel14.setText("Observao:");

        jLabel15.setText("Bairro:");

        jTbairro.setEditable(false);
        jTbairro.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(80,true));
        jTbairro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTbairroActionPerformed(evt);
            }
        });

        jTiddistrito.setEditable(false);

        jTidpessoa.setEditable(false);

        jBcadcnpj.setText("...");
        jBcadcnpj.setEnabled(false);
        jBcadcnpj.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBcadcnpjActionPerformed(evt);
            }
        });

        jLabel19.setText("Responsvel:");

        jTresponsavel.setEditable(false);
        jTresponsavel.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(20,true));

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Sistema"));

        jLabel13.setText("Modulo:");

        jCmodulo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jCmodulo.setEnabled(false);

        jCnfe.setText("NFE");
        jCnfe.setEnabled(false);

        jCecf.setText("ECF");
        jCecf.setEnabled(false);

        jLabel20.setText("Plugins:");

        jDplugins.setEnabled(false);

        jCnfce.setText("NFCE");
        jCnfce.setEnabled(false);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jCmodulo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jDplugins, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel13)
                            .addComponent(jLabel20))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jCnfe)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jCecf)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCnfce, javax.swing.GroupLayout.DEFAULT_SIZE, 55, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel13)
                .addGap(1, 1, 1)
                .addComponent(jCmodulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCnfe)
                    .addComponent(jCecf)
                    .addComponent(jCnfce))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel20)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jDplugins, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jTobsatend.setEditable(false);
        jTobsatend.setColumns(20);
        jTobsatend.setDocument(new br.com.atmatech.sac.controller.LimitaCaracterUpper(100,true));
        jTobsatend.setLineWrap(true);
        jTobsatend.setRows(4);
        jTobsatend.setTabSize(5);
        jScrollPane7.setViewportView(jTobsatend);

        jLabel24.setText("Observao Atendimento:");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jTrazao, javax.swing.GroupLayout.PREFERRED_SIZE, 403, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(25, 25, 25)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jFtelefone1, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(25, 25, 25)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jCsituacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jFcnpj, javax.swing.GroupLayout.PREFERRED_SIZE, 191, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jBcadcnpj, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(20, 20, 20)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel4)
                                    .addComponent(jTinscrio, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jLabel2)
                            .addComponent(jLabel8)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jTemail, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jTresponsavel))
                            .addComponent(jTendereco, javax.swing.GroupLayout.PREFERRED_SIZE, 403, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTfantasia, javax.swing.GroupLayout.PREFERRED_SIZE, 403, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel15)
                                    .addComponent(jTbairro, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel12))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel19)
                                    .addComponent(jLabel10)
                                    .addComponent(jTnumero, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(25, 25, 25)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel14)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel7)
                                    .addComponent(jFtelefone3, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel6)
                                    .addComponent(jFtelefone2, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel9)
                                    .addComponent(jTcidade, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(2, 2, 2)
                                .addComponent(jBcidade, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jTidpessoa)
                                    .addComponent(jTiddistrito))))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jScrollPane7))
                    .addComponent(jLabel24))
                .addContainerGap(39, Short.MAX_VALUE))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jFtelefone1, jFtelefone2, jFtelefone3, jTcidade});

        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jLabel5)
                            .addComponent(jLabel11))
                        .addGap(1, 1, 1)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTrazao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jFtelefone1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jCsituacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(2, 2, 2)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addGap(25, 25, 25)
                                .addComponent(jLabel7)
                                .addGap(1, 1, 1)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jFtelefone3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTidpessoa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addGap(1, 1, 1)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jTfantasia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jFtelefone2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(2, 2, 2)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel4))
                                .addGap(1, 1, 1)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jFcnpj, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jTinscrio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jBcadcnpj, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(2, 2, 2)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9))
                        .addGap(1, 1, 1)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTendereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTcidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jBcidade, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTiddistrito, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel15)
                        .addGap(2, 2, 2)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTbairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTnumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(6, 6, 6)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel12)
                            .addComponent(jLabel19))
                        .addGap(2, 2, 2)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTemail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTresponsavel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(jLabel10)
                            .addComponent(jLabel24))
                        .addGap(1, 1, 1)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jScrollPane7)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))))
                .addGap(22, 22, 22))
        );

        jPanel2Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jFtelefone1, jFtelefone2, jFtelefone3, jTcidade});

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(21, 21, 21)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
                .addGap(1, 1, 1))
        );
    }// </editor-fold>//GEN-END:initComponents

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

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

        private void jBnovoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBnovoActionPerformed
            // TODO add your handling code here:
            ativaView();
            ativaSalvarCancelar();
            limpaView();
        }//GEN-LAST:event_jBnovoActionPerformed

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

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

        private void jBcidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBcidadeActionPerformed
            // TODO add your handling code here:
            buscaDistrito();
            jLindice.setText("MUNICIPIO");
            this.jDcidade.setLocationRelativeTo(jPanel2);
            this.jDcidade.setVisible(true);

        }//GEN-LAST:event_jBcidadeActionPerformed

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

        private void jTtcidadeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTtcidadeMouseClicked
            // TODO add your handling code here:
            jLindice.setText(jTtcidade.getColumnName(jTtcidade.getSelectedColumn()));
            jTconsulta.requestFocus();
        }//GEN-LAST:event_jTtcidadeMouseClicked

        private void jTconsultaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTconsultaKeyReleased
            // TODO add your handling code here:
            buscaDistrito(jTconsulta.getText(), jLindice.getText());
        }//GEN-LAST:event_jTconsultaKeyReleased

        private void jTcidadeFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTcidadeFocusLost
            // TODO add your handling code here:
            buscaDistrito(jTcidade.getText(), "DISTRITO");
            jLindice.setText("DISTRITO");
            jTconsulta.setText(jTcidade.getText());
            jDcidade.setLocationRelativeTo(null);
            jDcidade.setVisible(true);
        }//GEN-LAST:event_jTcidadeFocusLost

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

        private void jTconsultaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTconsultaKeyPressed
            // TODO add your handling code here:
            if (evt.getKeyCode() == KeyEvent.VK_F12 && jTtcidade.getSelectedRow() > -1) {
                jTiddistrito.setText(jTtcidade.getValueAt(jTtcidade.getSelectedRow(), 0).toString());
                jTcidade.setText(jTtcidade.getValueAt(jTtcidade.getSelectedRow(), 1).toString());
                jDcidade.setVisible(false);
            }
        }//GEN-LAST:event_jTconsultaKeyPressed

        private void jBalterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBalterarActionPerformed
            // TODO add your handling code here:
            if (!jTidpessoa.getText().equals("")) {
                ativaView();
                ativaSalvarCancelar();
            } else {
                JOptionPane.showMessageDialog(this, "Selecione um Registro", "Ateno", JOptionPane.ERROR_MESSAGE);
            }

        }//GEN-LAST:event_jBalterarActionPerformed

        private void jBexcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBexcluirActionPerformed
            try {
                // TODO add your handling code here:
                if (!jTidpessoa.getText().equals("")) {
                    if (JOptionPane.showConfirmDialog(null, "Deseja Excluir o Registro", "Ateno",
                            JOptionPane.YES_NO_OPTION) == 0) {
                        new PessoaDao().deletePessoa(Integer.valueOf(jTidpessoa.getText()));
                        ativaNovoAlterarExcluir();
                        limpaView();
                        desativaView();
                        buscaPessoa();
                        JOptionPane.showMessageDialog(this, "Registro Excluido", "Excluir",
                                JOptionPane.INFORMATION_MESSAGE);
                    }
                } else {
                    JOptionPane.showMessageDialog(this, "Selecione um Registro", "Excluir", JOptionPane.ERROR_MESSAGE);
                }
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(this, "Erro ao Excluir" + ex, "Excluir", JOptionPane.WARNING_MESSAGE);
            }

        }//GEN-LAST:event_jBexcluirActionPerformed

        private void jBsalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBsalvarActionPerformed
            // TODO add your handling code here:
            if (validaCampos()) {
                if (jTidpessoa.getText().equals("")) {
                    salvaPessoa();
                } else {
                    alterarPessoa();
                }
            } else {
                JOptionPane.showMessageDialog(this, "H Campos Obrigatorios", "Salvar",
                        JOptionPane.INFORMATION_MESSAGE);
            }

        }//GEN-LAST:event_jBsalvarActionPerformed

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

            // TODO add your handling code here:
            limpaView();
            desativaView();
            ativaNovoAlterarExcluir();

        }//GEN-LAST:event_jBcancelarActionPerformed

        private void jTtempresaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTtempresaKeyPressed
            // TODO add your handling code here:

            int coluna = jTtempresa.getSelectedColumn();
            if ((evt.getKeyCode() == KeyEvent.VK_F) && (coluna >= 0)) {
                if (evt.isControlDown()) {
                    String text = JOptionPane.showInputDialog(this, "Pesquisa: " + jTtempresa.getColumnName(coluna),
                            "PESQUISA", JOptionPane.WARNING_MESSAGE);
                    if (text != null) {
                        //DefaultTableModel tabela = (DefaultTableModel) jTtmodulo.getModel();
                        //final TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tabela);
                        // jTtmodulo.setRowSorter(sorter);
                        text = text.toUpperCase();
                        if (jTtempresa.getColumnName(coluna).equals("RAZAO")) {
                            buscaPessoa("RAZAO", text);
                        }
                        if (jTtempresa.getColumnName(coluna).equals("FANTASIA")) {
                            buscaPessoa("FANTASIA", text);
                        }
                        if (jTtempresa.getColumnName(coluna).equals("CNPJ")) {
                            buscaPessoa("CNPJ", text);
                        }
                        if (jTtempresa.getColumnName(coluna).equals("ENDERECO")) {
                            buscaPessoa("ENDERECO", text);
                        }
                    }

                }
            }
        }//GEN-LAST:event_jTtempresaKeyPressed

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

        private void jBopcaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBopcaoActionPerformed
            // TODO add your handling code here:
            if (!jTidpessoa.getText().equals("")) {
                jPopupMenu1.show(jBopcao, WIDTH, jBopcao.getHeight());
            } else {
                JOptionPane.showMessageDialog(this, "Selecione Um Cliente", "Arquivo", JOptionPane.INFORMATION_MESSAGE);
            }

        }//GEN-LAST:event_jBopcaoActionPerformed

        private void jMcarregararquivoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMcarregararquivoMouseClicked

        }//GEN-LAST:event_jMcarregararquivoMouseClicked

        private void jMcarregararquivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMcarregararquivoActionPerformed
            // TODO add your handling code here:
            if (jFileChooser2.showOpenDialog(this) == 0) {
                try {
                    AnexoBeans ab = new AnexoBeans();
                    ab.setDescricao(jFileChooser2.getName(jFileChooser2.getSelectedFile()));
                    ab.setExtensao("");
                    ab.setArquivo(converteArquivo(jFileChooser2.getSelectedFile()));
                    ab.setIdpessoa(Integer.valueOf(jTidpessoa.getText()));
                    new AnexoDao().setAnexo(ab);
                    JOptionPane.showMessageDialog(null, "Arquivo Importado com Sucesso", "Arquivo",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException ex) {
                    JOptionPane.showMessageDialog(null, "Erro Ao Converter Arquivo Selecionado" + ex);
                } catch (SQLException ex) {
                    JOptionPane.showMessageDialog(null, "Erro Ao Salvar Arquivo Selecionado" + ex);
                }

                //JOptionPane.showMessageDialog(this, "Diretorio"+jFileChooser2.getSelectedFile()+"\n Arquivo "+jFileChooser2.getName(jFileChooser2.getSelectedFile()));
            }

        }//GEN-LAST:event_jMcarregararquivoActionPerformed

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

        private void jFileChooser2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jFileChooser2MouseClicked
            // TODO add your handling code here:   
            jFileChooser2.showOpenDialog(this);
        }//GEN-LAST:event_jFileChooser2MouseClicked

        private void jMexportararquivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMexportararquivoActionPerformed
            // TODO add your handling code here:    
            buscaAnexo();
            jDarquivo.setLocationRelativeTo(null);
            jDarquivo.setVisible(true);

        }//GEN-LAST:event_jMexportararquivoActionPerformed

        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
            // TODO add your handling code here:
            jFileChooser2.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            if (jFileChooser2.showSaveDialog(this) == 0) {
                try {
                    for (int i = 0; i < jTtanexo.getRowCount(); i++) {
                        if (jTtanexo.getValueAt(i, 1).equals(true)) {
                            exportarArquivo(lab.get(i).getArquivo(), lab.get(i).getDescricao(),
                                    jFileChooser2.getSelectedFile());
                        }
                    }
                    JOptionPane.showMessageDialog(null, "Arquivo Exportado com Sucesso", "Arquivo",
                            JOptionPane.INFORMATION_MESSAGE);
                } catch (IOException ex) {
                    JOptionPane.showMessageDialog(null, "Erro ao Exportar Arquivo\n" + ex);
                }
            }
        }//GEN-LAST:event_jButton1ActionPerformed

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

            new Thread(new Runnable() {
                @Override
                public void run() {
                    try {
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                showAguarde();
                            }
                        }).start();
                        // TODO add your handling code here:
                        DBConfigBeans cb = new DBConfigBeans();
                        //jTdchave.setText(new WebServiceAtivacao().login("http://atma.serveftp.com/atma/view/index.php?page=CLIENTE", cb.getLogin(), cb.getSenha(), jFcnpj.getText(), "1", "30"));
                        if (new WebServiceAtivacao().login("http://atma.serveftp.com/atma/view/index.php?page=CLIENTE",
                                cb.getLogin(), cb.getSenha(), jFcnpj.getText())) {
                            Runtime.getRuntime().exec("cmd.exe /c ativacao.html");
                        }
                        jDaguarde.setVisible(false);
                    } catch (IOException ex) {
                        jDaguarde.setVisible(false);
                        JOptionPane.showMessageDialog(null, "Erro ao Conectar com Servidor\n" + ex);
                    }
                }
            }).start();

        }//GEN-LAST:event_jMativaActionPerformed

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

        new Thread(new Runnable() {

            @Override
            public void run() {
                try {
                    new Thread(new Runnable() {

                        @Override
                        public void run() {
                            showAguarde();
                        }
                    }).start();
                    // TODO add your handling code here:
                    PessoaBeans pb = new PessoaBeans();
                    pb = new WebServiceCadastro().postWebService(jFcnpj.getText());
                    if (pb.getRazao() != null) {
                        jTrazao.setText(pb.getRazao());
                        jTinscrio.setText(pb.getIe());
                        jTendereco.setText(pb.getEndereco());
                        jTnumero.setText(pb.getNumero());
                        jTbairro.setText(pb.getBairro());
                        jFtelefone3.setText(pb.getTelefone1());
                        jDaguarde.setVisible(false);
                    } else {
                        jDaguarde.setVisible(false);
                        JOptionPane.showMessageDialog(null, "CNPJ No Encontrado\n");
                    }
                } catch (IOException ex) {
                    jDaguarde.setVisible(false);
                    JOptionPane.showMessageDialog(null, "Erro ao Conectar com Servidor\n" + ex);
                }
            }
        }).start();
//        try {
//            // TODO add your handling code here:
//            PessoaBeans pb=new PessoaBeans();
//            pb=new WebServiceCadastro().postWebService(jFcnpj.getText());
//            if(pb.getRazao()!= null){
//                jTrazao.setText(pb.getRazao());
//                jTinscrio.setText(pb.getIe());
//                jTendereco.setText(pb.getEndereco());
//                jTnumero.setText(pb.getNumero());
//                jTbairro.setText(pb.getBairro());
//                jFtelefone1.setText(pb.getTelefone1());
//            }else{
//                JOptionPane.showMessageDialog(this, "CNPJ No Encontrado\n");
//            }
//        } catch (IOException ex) {
//            JOptionPane.showMessageDialog(this, "Erro ao Conectar com Servidor\n" + ex);
//        }

    }//GEN-LAST:event_jBcadcnpjActionPerformed

        private void jBfinanceiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBfinanceiroActionPerformed
            //TODO add your handling code here:
            JDwebFinanceiro.setLocationRelativeTo(this);
            JDwebFinanceiro.setVisible(true);
        }//GEN-LAST:event_jBfinanceiroActionPerformed

        private void JDwebFinanceiroWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_JDwebFinanceiroWindowOpened
            // TODO add your handling code here:
            //        DBConfigBeans cb = new DBConfigBeans();
            //        try {
            //            new WebServiceFinanceiro().login("http://atma.serveftp.com/atma/cadastro.php", cb.getLogin(), cb.getSenha(), jFcnpj.getText(), "lista_baixa.php");
            //        } catch (IOException ex) {
            //            Logger.getLogger(ViewPessoa.class.getName()).log(Level.SEVERE, null, ex);
            //        }

            DisplayHtml("http://www.google.com.br");

        }//GEN-LAST:event_JDwebFinanceiroWindowOpened

        private void jMemailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMemailActionPerformed
            // TODO add your handling code here:
            if (jTemail.getText().equals("")) {
                JOptionPane.showMessageDialog(null, "Cliente no Possui Email");
            } else {
                jDemail.setLocationRelativeTo(this);
                jDemail.setVisible(true);
            }
        }//GEN-LAST:event_jMemailActionPerformed

        private void jBemailmassaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBemailmassaActionPerformed
            // TODO add your handling code here:

            new Thread(new Runnable() {
                @Override
                public void run() {
                    showAguarde();
                }
            }).start();

            new Thread(new Runnable() {
                @Override
                public void run() {
                    UsuarioLogadoBeans ulb = new UsuarioLogadoBeans();
                    try {
                        new Email().emai(ulb.getSmtp(), ulb.getEmail(), ulb.getSenhaemail(), ulb.getPorta(),
                                ulb.getSsl(), ulb.getTls(), jTemail.getText(), ulb.getEmail(), jTPconteudo.getText(),
                                jTassunto.getText());
                        jDemail.setVisible(false);
                    } catch (EmailException ex) {
                        jDemail.setVisible(false);
                        jDaguarde.setVisible(false);
                        JOptionPane.showMessageDialog(null, "Erro ao Enviar Email\n" + ex);
                    } catch (MalformedURLException ex) {
                        jDemail.setVisible(false);
                        jDaguarde.setVisible(false);
                        JOptionPane.showMessageDialog(null, "Erro de URL ao Enviar Email\n" + ex);
                    }
                    jDaguarde.setVisible(false);
                }
            }).start();
        }//GEN-LAST:event_jBemailmassaActionPerformed

        private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
            // TODO add your handling code here:
            if (inicializatela) {
                carregaPesquisa();
                inicializatela = false;
            }

        }//GEN-LAST:event_formComponentShown

        // Variables declaration - do not modify//GEN-BEGIN:variables
        private javax.swing.JDialog JDwebFinanceiro;
        private javax.swing.JButton jBalterar;
        private javax.swing.JButton jBcadcnpj;
        private javax.swing.JButton jBcancelar;
        private javax.swing.JButton jBcidade;
        private javax.swing.JButton jBemailmassa;
        private javax.swing.JButton jBexcluir;
        private javax.swing.JButton jBfinanceiro;
        private javax.swing.JButton jBnovo;
        private javax.swing.JButton jBopcao;
        private javax.swing.JButton jBsalvar;
        private javax.swing.JButton jButton1;
        private javax.swing.JCheckBox jCecf;
        private javax.swing.JComboBox jCmodulo;
        private javax.swing.JCheckBox jCnfce;
        private javax.swing.JCheckBox jCnfe;
        private javax.swing.JComboBox jCsituacao;
        private javax.swing.JDialog jDaguarde;
        private javax.swing.JDialog jDarquivo;
        private javax.swing.JDialog jDchave;
        private javax.swing.JDialog jDcidade;
        private javax.swing.JDialog jDemail;
        private javax.swing.JDialog jDfilechoose;
        private com.toedter.calendar.JDateChooser jDplugins;
        private javax.swing.JEditorPane jEditorPane1;
        private javax.swing.JFormattedTextField jFcnpj;
        private javax.swing.JFileChooser jFileChooser2;
        private javax.swing.JFormattedTextField jFtelefone1;
        private javax.swing.JFormattedTextField jFtelefone2;
        private javax.swing.JFormattedTextField jFtelefone3;
        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 jLabel3;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JLabel jLabel6;
        private javax.swing.JLabel jLabel7;
        private javax.swing.JLabel jLabel8;
        private javax.swing.JLabel jLabel9;
        private javax.swing.JLabel jLindice;
        private javax.swing.JMenu jMArquivo;
        private javax.swing.JMenuItem jMativa;
        private javax.swing.JMenu jMativacao;
        private javax.swing.JMenuItem jMcarregararquivo;
        private javax.swing.JMenuItem jMemail;
        private javax.swing.JMenuItem jMexportararquivo;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        private javax.swing.JPanel jPanel3;
        private javax.swing.JPanel jPanel4;
        private javax.swing.JPanel jPanel5;
        private javax.swing.JPanel jPanel6;
        private javax.swing.JPopupMenu jPopupMenu1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JScrollPane jScrollPane2;
        private javax.swing.JScrollPane jScrollPane3;
        private javax.swing.JScrollPane jScrollPane4;
        private javax.swing.JScrollPane jScrollPane5;
        private javax.swing.JScrollPane jScrollPane6;
        private javax.swing.JScrollPane jScrollPane7;
        private javax.swing.JTextPane jTPconteudo;
        private javax.swing.JTextField jTassunto;
        private javax.swing.JTextField jTbairro;
        private javax.swing.JTextField jTcidade;
        private javax.swing.JTextField jTconsulta;
        private javax.swing.JTextField jTdchave;
        private javax.swing.JTextField jTemail;
        private javax.swing.JTextField jTendereco;
        private javax.swing.JTextField jTfantasia;
        private javax.swing.JTextField jTiddistrito;
        private javax.swing.JTextField jTidpessoa;
    private javax.swing.JTextField jTinscrio;
        private javax.swing.JTextField jTnumero;
        public javax.swing.JTextArea jTobs;
        private javax.swing.JTextArea jTobsatend;
        private javax.swing.JTextField jTrazao;
        private javax.swing.JTextField jTresponsavel;
        private javax.swing.JTable jTtanexo;
        private javax.swing.JTable jTtcidade;
        private javax.swing.JTable jTtempresa;

        // End of variables declaration//GEN-END:variables
public void ativaView() {
        jBcadcnpj.setEnabled(true);
        jTrazao.setEditable(true);
        jTfantasia.setEditable(true);
        jFcnpj.setEditable(true);
        jTinscrio.setEditable(true);
        jTendereco.setEditable(true);
        jTnumero.setEditable(true);
        jTemail.setEditable(true);
        jCmodulo.setEnabled(true);
        jFtelefone1.setEditable(true);
        jFtelefone2.setEditable(true);
        jFtelefone2.setEditable(true);
        jTcidade.setEditable(true);
        jTcidade.setEnabled(true);
        jTobs.setEditable(true);
        jTobsatend.setEditable(true);
        jCsituacao.setEnabled(true);
        jFtelefone3.setEditable(true);
        jTbairro.setEditable(true);
        jBcidade.setEnabled(true);
        jTtempresa.setEnabled(false);
        jTtempresa.clearSelection();
        jTresponsavel.setEditable(true);
        jCecf.setEnabled(true);
        jCnfe.setEnabled(true);
        jCnfce.setEnabled(true);
        jDplugins.setEnabled(true);
    }

    public void desativaView() {
        jBcadcnpj.setEnabled(true);
        jTrazao.setEditable(false);
        jTfantasia.setEditable(false);
        jFcnpj.setEditable(false);
        jTinscrio.setEditable(false);
        jTendereco.setEditable(false);
        jTnumero.setEditable(false);
        jTemail.setEditable(false);
        jCmodulo.setEnabled(false);
        jFtelefone1.setEditable(false);
        jFtelefone2.setEditable(false);
        jFtelefone2.setEditable(false);
        jTcidade.setEditable(false);
        jTcidade.setEnabled(false);
        jTobs.setEditable(false);
        jTobsatend.setEditable(false);
        jCsituacao.setEnabled(false);
        jFtelefone3.setEditable(false);
        jTbairro.setEditable(false);
        jBcidade.setEnabled(false);
        jTtempresa.setEnabled(true);
        jTresponsavel.setEditable(false);
        jCecf.setEnabled(false);
        jCnfe.setEnabled(false);
        jCnfce.setEnabled(false);
        jDplugins.setEnabled(false);
    }

        private void buscaModulo() {
            jCmodulo.removeAllItems();
            try {
                mb = new ModuloDao().getModulo();
                for (ModuloBeans mb1 : mb) {
                    jCmodulo.addItem(mb1.getDescricao());
                }
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(null, "Erro ao Consultar Modulos\n" + ex);
            }

        }

        private void buscaSituacao() {
            jCsituacao.removeAllItems();
            try {
                lsb = new SituacaoDao().getSituacao();
                for (SituacaoBeans sb : lsb) {
                    jCsituacao.addItem(sb.getDescricao());
                }
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(null, "Erro ao Consultar Situao\n" + ex);
            }

        }

        private void buscaDistrito() {
            DefaultTableModel tcidade = (DefaultTableModel) jTtcidade.getModel();
            tcidade.setNumRows(0);
            ldb = new DistritoDao().getDistrito();
            for (DistritoBeans db : ldb) {
                tcidade.addRow(new Object[] { db.getIddistrito(), db.getDistrito(), db.getMunicipio(), db.getUf(),
                        db.getPais() });
            }
        }

        private void buscaDistrito(String filtro, String campo) {
            DefaultTableModel tcidade = (DefaultTableModel) jTtcidade.getModel();
            tcidade.setNumRows(0);
            ldb = new DistritoDao().getDistrito(filtro, campo);
            for (DistritoBeans db : ldb) {
                tcidade.addRow(new Object[] { db.getIddistrito(), db.getDistrito(), db.getMunicipio(), db.getUf(),
                        db.getPais() });
            }
        }

        private void ativaSalvarCancelar() {
            jBnovo.setEnabled(false);
            jBalterar.setEnabled(false);
            jBcancelar.setEnabled(true);
            jBexcluir.setEnabled(false);
            jBsalvar.setEnabled(true);
        }

        private void ativaNovoAlterarExcluir() {
            jBnovo.setEnabled(true);
            jBalterar.setEnabled(true);
            jBcancelar.setEnabled(false);
            jBexcluir.setEnabled(true);
            jBsalvar.setEnabled(false);
        }

    private void limpaView() {
        jTrazao.setText("");
        jTfantasia.setText("");
        jFcnpj.setText("");
        jTinscrio.setText("");
        jTendereco.setText("");
        jTnumero.setText("");
        jTemail.setText("");
        jCmodulo.setSelectedIndex(0);
        jFtelefone1.setText("");
        jFtelefone2.setText("");
        jFtelefone2.setText("");
        jTcidade.setText("");
        jTobs.setText("");
        jTobsatend.setText("");
        jCsituacao.setSelectedIndex(0);
        jFtelefone3.setText("");
        jTbairro.setText("");
        //jBcidade.setText("");
        jTiddistrito.setText("");
        jTidpessoa.setText("");
        jTresponsavel.setText("");
        jCecf.setSelected(false);
        jCnfe.setSelected(false);
        jCnfce.setSelected(false);
        jDplugins.setDate(null);
    }

        private void buscaPessoa() {
            DefaultTableModel tabelapessoa = (DefaultTableModel) jTtempresa.getModel();
            tabelapessoa.setNumRows(0);
            try {
                lpb = new PessoaDao().getPessoa();
                for (PessoaBeans pb : lpb) {
                    tabelapessoa.addRow(new Object[] { pb.getIdpessoa(), pb.getRazao(), pb.getFantasia(), pb.getCnpj(),
                            pb.getEndereco() });
                }
            } catch (SQLException ex) {
                JOptionPane.showMessageDialog(null, "Erro ao Consultar Clientes\n" + ex);
            }

        }

        private void buscaPessoa(String coluna, String parametro) {
            DefaultTableModel tabelapessoa = (DefaultTableModel) jTtempresa.getModel();
            tabelapessoa.setNumRows(0);
            lpb = new PessoaDao().getPessoa(coluna, parametro, coluna);
            for (PessoaBeans pb : lpb) {
                tabelapessoa.addRow(new Object[] { pb.getIdpessoa(), pb.getRazao(), pb.getFantasia(), pb.getCnpj(),
                        pb.getEndereco() });
            }
            if (tabelapessoa.getRowCount() == 0) {
                tabelapessoa.addRow(new Object[] {});
            }
        }

        private void desativaColunas() {
            jTtcidade.getColumnModel().getColumn(0).setMaxWidth(0);
            jTtcidade.getColumnModel().getColumn(0).setMinWidth(0);
            jTtcidade.getColumnModel().getColumn(0).setPreferredWidth(0);

            jTtempresa.getColumnModel().getColumn(0).setMaxWidth(0);
            jTtempresa.getColumnModel().getColumn(0).setMinWidth(0);
            jTtempresa.getColumnModel().getColumn(0).setPreferredWidth(0);

            jTtanexo.getColumnModel().getColumn(0).setMaxWidth(0);
            jTtanexo.getColumnModel().getColumn(0).setMinWidth(0);
            jTtanexo.getColumnModel().getColumn(0).setPreferredWidth(0);
        }

    private void salvaPessoa() {
        try {
            PessoaBeans pb = new PessoaBeans();
            pb.setRazao(jTrazao.getText());
            pb.setFantasia(jTfantasia.getText());
            pb.setCnpj(jFcnpj.getText());
            pb.setIe(jTinscrio.getText());
            pb.setEndereco(jTendereco.getText());
            pb.setIddistrito(Integer.valueOf(jTiddistrito.getText()));
            pb.setNumero(jTnumero.getText());
            pb.setEmail(jTemail.getText());
            pb.setIdmodulo(mb.get(jCmodulo.getSelectedIndex()).getIdmodulo());
            pb.setTelefone1(jFtelefone1.getText());
            pb.setTelefone2(jFtelefone2.getText());
            pb.setTelefone3(jFtelefone3.getText());
            pb.setIdsituacao(lsb.get(jCsituacao.getSelectedIndex()).getIdsituacao());
            pb.setObs(jTobs.getText());
            pb.setObsatend(jTobsatend.getText());
            pb.setBairro(jTbairro.getText());
            pb.setResponsavel(jTresponsavel.getText());
            pb.setEcf(jCecf.isSelected());
            pb.setNfe(jCnfe.isSelected());
            pb.setNfce(jCnfce.isSelected());
            if (jDplugins.getDate() != null) {
                pb.setPlugins(new Date(jDplugins.getDate().getTime()));
            }
            PessoaDao pd = new PessoaDao();
            pd.setPessoa(pb);
            JOptionPane.showMessageDialog(this, "Registro Salvo com Sucesso.", "Salvar", JOptionPane.INFORMATION_MESSAGE);
            limpaView();
            desativaView();
            ativaNovoAlterarExcluir();
            buscaPessoa();
        } catch (SQLException | NumberFormatException ex) {
            if (ex.toString().contains("UNQ1_PESSOA")) {
                JOptionPane.showMessageDialog(this, "CNPJ J se Encontra Cadastrado\n", "Salvar", JOptionPane.ERROR_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(this, "Erro ao Salvar\n" + ex, "Salvar", JOptionPane.ERROR_MESSAGE);
            }
        }
    }

    private void clickPessoa() {
        for (int i = 0; i < lpb.size(); i++) {
            if (i == jTtempresa.getSelectedRow()) {
                jTrazao.setText(lpb.get(i).getRazao());
                jTfantasia.setText(lpb.get(i).getFantasia());
                jTidpessoa.setText(lpb.get(i).getIdpessoa().toString());
                jFtelefone1.setText(lpb.get(i).getTelefone1());
                jFtelefone2.setText(lpb.get(i).getTelefone2());
                jFtelefone3.setText(lpb.get(i).getTelefone3());
                jFcnpj.setText(lpb.get(i).getCnpj());
                jTinscrio.setText(lpb.get(i).getIe());
                jTendereco.setText(lpb.get(i).getEndereco());
                jTbairro.setText(lpb.get(i).getBairro());
                jTnumero.setText(lpb.get(i).getNumero());
                jTemail.setText(lpb.get(i).getEmail());
                jTobs.setText(lpb.get(i).getObs());
                jTiddistrito.setText(lpb.get(i).getIddistrito().toString());
                jTcidade.setText(lpb.get(i).getDistrito());
                jTresponsavel.setText(lpb.get(i).getResponsavel());
                jCecf.setSelected(lpb.get(i).isEcf());
                jCnfe.setSelected(lpb.get(i).isNfe());
                jCnfce.setSelected(lpb.get(i).isNfce());
                jDplugins.setDate(lpb.get(i).getPlugins());
                jTobsatend.setText(lpb.get(i).getObsatend());

                for (int j = 0; j < mb.size(); j++) {
                    if (mb.get(j).getIdmodulo().equals(lpb.get(i).getIdmodulo())) {
                        jCmodulo.setSelectedIndex(j);
                    }
                }
                for (int j = 0; j < lsb.size(); j++) {
                    if (lsb.get(j).getIdsituacao().equals(lpb.get(i).getIdsituacao())) {
                        jCsituacao.setSelectedIndex(j);
                    }
                }
                return;
            }
        }
    }

    private void alterarPessoa() {
        try {
            PessoaBeans pb = new PessoaBeans();
            pb.setRazao(jTrazao.getText());
            pb.setFantasia(jTfantasia.getText());
            pb.setCnpj(jFcnpj.getText());
            pb.setIe(jTinscrio.getText());
            pb.setEndereco(jTendereco.getText());
            pb.setIddistrito(Integer.valueOf(jTiddistrito.getText()));
            pb.setNumero(jTnumero.getText());
            pb.setEmail(jTemail.getText());
            pb.setIdmodulo(mb.get(jCmodulo.getSelectedIndex()).getIdmodulo());
            pb.setTelefone1(jFtelefone1.getText());
            pb.setTelefone2(jFtelefone2.getText());
            pb.setTelefone3(jFtelefone3.getText());
            pb.setIdsituacao(lsb.get(jCsituacao.getSelectedIndex()).getIdsituacao());
            pb.setObs(jTobs.getText());
            pb.setObsatend(jTobsatend.getText());
            pb.setBairro(jTbairro.getText());
            pb.setIdpessoa(Integer.valueOf(jTidpessoa.getText()));
            pb.setResponsavel(jTresponsavel.getText());
            pb.setEcf(jCecf.isSelected());
            pb.setNfe(jCnfe.isSelected());
            pb.setNfce(jCnfce.isSelected());
            if (jDplugins.getDate() != null) {
                pb.setPlugins(new Date(jDplugins.getDate().getTime()));
            }
            PessoaDao pd = new PessoaDao();
            pd.updatePessoa(pb);
            JOptionPane.showMessageDialog(this, "Registro Alterado com Sucesso.", "Alterar", JOptionPane.INFORMATION_MESSAGE);
            limpaView();
            desativaView();
            ativaNovoAlterarExcluir();
            buscaPessoa();
        } catch (SQLException | NumberFormatException ex) {
            if (ex.toString().contains("UNQ1_PESSOA")) {
                JOptionPane.showMessageDialog(this, "CNPJ J se Encontra Cadastrado\n", "Salvar", JOptionPane.ERROR_MESSAGE);
            } else {
                JOptionPane.showMessageDialog(this, "Erro ao Alterar" + ex, "Alterar", JOptionPane.ERROR_MESSAGE);
            }
        }

    }

        private boolean validaCampos() {
            if (jTiddistrito.getText().equals("")) {
                return false;
            }
            if (jFcnpj.getText().length() != 14) {
                return false;
            }
            if (jTrazao.getText().equals("")) {
                return false;
            }
            return true;
        }

        private byte[] converteArquivo(File f) throws FileNotFoundException, IOException {
            InputStream is = new FileInputStream(f);
            byte[] bytes = new byte[(int) f.length()];
            int offset = 0;
            int numRead = 0;
            while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
                offset += numRead;
            }
            return bytes;
        }

        private void buscaAnexo() {
            DefaultTableModel tbanexo = (DefaultTableModel) jTtanexo.getModel();
            tbanexo.setNumRows(0);
            lab = new AnexoDao().getAnexo(Integer.valueOf(jTidpessoa.getText()));
            for (AnexoBeans ab : lab) {
                tbanexo.addRow(new Object[] { ab.getIdanexo(), false, ab.getDescricao(), ab.getData() });
            }
        }

        private void exportarArquivo(byte[] bytes, String nome, File local) throws FileNotFoundException, IOException {
            File f = new File(local + "\\" + nome);
            FileOutputStream fos = new FileOutputStream(f);
            fos.write(bytes);
            fos.close();
        }

        private void permissaoUsuario() {
            int ver = 0;
            if (!new NivelAcesso().getAcesso("ViewPessoa", "cadastrar", false)) {
                jBnovo.setVisible(false);
                jBopcao.setVisible(false);
                ver++;
            } else {
                jBopcao.setVisible(true);
            }
            if (!new NivelAcesso().getAcesso("ViewPessoa", "alterar", false)) {
                jBalterar.setVisible(false);
                jBopcao.setVisible(false);
                ver++;
            } else {
                jBopcao.setVisible(true);
            }
            if (!new NivelAcesso().getAcesso("ViewPessoa", "excluir", false)) {
                jBexcluir.setVisible(false);
                ver++;
            }
            if (ver == 3) {
                jPanel1.setVisible(false);
            }

        }

        private void carregaPesquisa() {

            new Thread(new Runnable() {

                @Override
                public void run() {
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            showAguarde();
                        }
                    }).start();
                    buscaModulo();
                    buscaSituacao();
                    buscaPessoa();
                    jDaguarde.setVisible(false);
                }
            }).start();

        }

        public void DisplayHtml(String urlString) {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container con = frame.getContentPane();
            JEditorPane jep = new JEditorPane();
            JScrollPane jsp = new JScrollPane(jep);
            con.add(jsp);
            jep.setContentType("text/html");
            try {
                jep.setPage(urlString);
            } catch (Exception e) {
                e.printStackTrace();
            }
            frame.setBounds(50, 50, 600, 800);
            frame.setVisible(true);
        }
        //  public static void main(String[] args){
        //    String ustr = "http://homepage1.nifty.com/algafield/";
        //    if (args.length > 0){ // local file URL should begin with file://
        //      ustr = args[0];     // ex.  file:///root/mytest.html
        //    }                     // ex.  file://C:\mytest.html
        //    new DisplayHtml(ustr);

        private void inicializaAtalhos() {
            //Atalho novo
            KeyStroke keyStrokeJBnovo = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0);
            String actionNameJBnovo = "F1";
            InputMap inputMapJBnovo = jBnovo.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

            inputMapJBnovo.put(keyStrokeJBnovo, actionNameJBnovo);
            ActionMap actionMapJBnovo = jBnovo.getActionMap();
            actionMapJBnovo.put(actionNameJBnovo, acaoJBnovo);

            //Atalho alterar
            KeyStroke keyStrokeJBalterar = KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0);
            String actionNameJBalterar = "F3";
            InputMap inputMapJBalterar = jBalterar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

            inputMapJBalterar.put(keyStrokeJBalterar, actionNameJBalterar);
            ActionMap actionMapJBalterar = jBalterar.getActionMap();
            actionMapJBalterar.put(actionNameJBalterar, acaoJBalterar);

            //Atalho salvar
            KeyStroke keyStrokeJBsalvar = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0);
            String actionNameJBsalvar = "F2";
            InputMap inputMapJBsalvar = jBsalvar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

            inputMapJBsalvar.put(keyStrokeJBsalvar, actionNameJBsalvar);
            ActionMap actionMapJBsalvar = jBsalvar.getActionMap();
            actionMapJBsalvar.put(actionNameJBsalvar, acaoJBsalvar);

            //Atalho excluir
            KeyStroke keyStrokeJBexcluir = KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0);
            String actionNameJBexcluir = "F4";
            InputMap inputMapJBexcluir = jBexcluir.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);

            inputMapJBexcluir.put(keyStrokeJBexcluir, actionNameJBexcluir);
            ActionMap actionMapJBexcluir = jBexcluir.getActionMap();
            actionMapJBexcluir.put(actionNameJBexcluir, acaoJBexcluir);

            //Atalho cancelar
            //        KeyStroke keyStrokeJBcancelar = KeyStroke.getKeyStroke(KeyEvent.VK_F5,0);
            //        String actionNameJBcancelar = "F5";
            //        InputMap inputMapJBcancelar = jBcancelar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
            //
            //        inputMapJBcancelar.put(keyStrokeJBcancelar, actionNameJBcancelar);
            //        ActionMap actionMapJBcancelar = jBcancelar.getActionMap();
            //        actionMapJBcancelar.put(actionMapJBcancelar, acaoJBcancelar);
        }

        //FUNCAO de atalho novo
        Action acaoJBnovo=new AbstractAction(){ //funcao da acao do botao
        @Override public void actionPerformed(ActionEvent e){
        //simula o click no boto  
        jBnovo.doClick();

        }};

        //FUNCAO de atalho alterar
        Action acaoJBalterar=new AbstractAction(){ //funcao da acao do botao
        @Override public void actionPerformed(ActionEvent e){
        //simula o click no boto  
        jBalterar.doClick();}};

        //FUNCAO de atalho salvar
        Action acaoJBsalvar=new AbstractAction(){ //funcao da acao do botao
        @Override public void actionPerformed(ActionEvent e){
        //simula o click no boto  
        jBsalvar.doClick();}};

        //FUNCAO de atalho excluir
        Action acaoJBexcluir=new AbstractAction(){ //funcao da acao do botao
        @Override public void actionPerformed(ActionEvent e){
        //simula o click no boto  

        jBexcluir.doClick();}};

        //    //FUNCAO de atalho cancelar
        //    Action acaoJBcancelar = new AbstractAction() {  //funcao da acao do botao
        //        @Override
        //        public void actionPerformed(ActionEvent e) {
        //            //simula o click no boto 
        //            System.out.println("cancelar");
        //            jBcancelar.doClick();
        //            
        //        }       
        //    };marcos
        public void showAguarde() {
            jDaguarde.setLocationRelativeTo(this.jPanel2);
            jDaguarde.setVisible(true);
        }

    }