Boa noite pessoal
Estou desenvolvendo um sistema com swing e as minhas telas estão gastando muito tempo na inicialização delas. Eu já verifiquei a questão de estar somente criando os componentes e mesmo assim gasta muito tempo. Tem um que está gastando de 4 a 12 segundos, dependendo da vez.
Abaixo tem um dos frames para vocês terem uma ideia.
[code]/*
- Tebo Software
- 07/09/2014
*/
package br.com.tebosoftware.cliente;
import br.com.tebosoftware.gui.conversor.CnpjConversor;
import br.com.tebosoftware.gui.conversor.CpfConversor;
import br.com.tebosoftware.controlador.ControladorFactory;
import br.com.tebosoftware.gui.GuiControladorCrud;
import br.com.tebosoftware.gui.Janela;
import br.com.tebosoftware.gui.componentes.FixedLengthDocument;
import br.com.tebosoftware.gui.componentes.IntegerOnlyDocument;
import br.com.tebosoftware.gui.componentes.ProcessandoDialog;
import br.com.tebosoftware.pessoa.InformacaoBancaria;
import br.com.tebosoftware.util.Util;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeListener;
import java.text.ParseException;
import java.util.logging.Level;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.MaskFormatter;
/**
*
-
@author Thales
*/
public class FormCadCliente extends javax.swing.JPanel implements Janela {private static final String TITULO = "Cadastro de Clientes";
private final ClienteControladorCrud controlador;
private final GuiControladorCrud guiControladorCrud;/**
-
Creates new form FormCadCliente
*/
public FormCadCliente() {
controlador = ControladorFactory.createClienteControladorCrud();
initComponents();
barraCrud.setControlador(controlador);
painelPesquisaCliente.setControlador(controlador);
painelContatos.setControlador(controlador);
painelOutrosEnderecos.setControlador(controlador);
FixedLengthDocument.instalar(txtNome, Cliente.RAZAO_SOCIAL_LENGTH);
FixedLengthDocument.instalar(txtSite, Cliente.SITE_LENGTH);
FixedLengthDocument.instalar(txtRG, Cliente.DOCUMENTO_LENGTH);
FixedLengthDocument.instalar(txtRGOrgao, Cliente.DOCUMENTO_LENGTH);
FixedLengthDocument.instalar(txtInscricaoEstadual, Cliente.DOCUMENTO_LENGTH);
FixedLengthDocument.instalar(txtInscricaoMunicipal, Cliente.DOCUMENTO_LENGTH);
IntegerOnlyDocument.instalar(txtAgencia, InformacaoBancaria.AGENCIA_LENGTH);
FixedLengthDocument.instalar(txtConta, InformacaoBancaria.CONTA_LENGTH);
FixedLengthDocument.instalar(txtDigito, InformacaoBancaria.DIGITO_LENGTH);
FixedLengthDocument.instalar(tarObservacao, Cliente.OBSERVACAO_LENGTH);
try {
MaskFormatter mf = new MaskFormatter("###.###.###-##");
mf.setValueContainsLiteralCharacters(true);
mf.setPlaceholderCharacter(’’);
DefaultFormatterFactory dff = new DefaultFormatterFactory(mf);
txtCpf.setFormatterFactory(dff);
dff = new DefaultFormatterFactory(mf);
mf = new MaskFormatter("##.###.###/####-##");
mf.setValueContainsLiteralCharacters(true);
mf.setPlaceholderCharacter(’’);
txtCnpj.setFormatterFactory(dff);
} catch (ParseException ex) {
Util.getLogger().log(Level.SEVERE, null, ex);
}
controlador.addPropertyChangeListener(“editando”, (e) -> {
firePropertyChange(“editando”, e.getOldValue(), e.getNewValue());
});
PropertyChangeListener l = (e) -> {
firePropertyChange(“pessoaFisica”, !isPessoaFisica(), isPessoaFisica());
};
controlador.addPropertyChangeListener(“entidade”, (e) -> {
Cliente velho = (Cliente) e.getOldValue();
Cliente novo = (Cliente) e.getNewValue();
if (velho != null) {
velho.removePropertyChangeListener(“pessoaFisica”, l);
}
if (novo != null) {
novo.addPropertyChangeListener(“pessoaFisica”, l);
}
});
guiControladorCrud = new GuiControladorCrud(controlador, tpnDados, pnlPesquisa, pnlRegistro, painelPesquisaCliente.getTabelaCliente()) {@Override protected void aoMostrarPesquisa() { txtNome.requestFocus(); txtNome.selectAll(); } @Override protected void aoMostrarRegistro() { painelPesquisaCliente.requestFocus(); }
};
}
public ClienteControladorCrud getControlador() {
return controlador;
}private void pesquisar() {
ProcessandoDialog.processar(() -> {
controlador.pesquisar();
});
}public boolean isEditando() {
return controlador.isEditando();
}public boolean isPessoaFisica() {
return (controlador != null && controlador.getEntidade() != null ? controlador.getEntidade().isPessoaFisica() : false);
}/**
-
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”>
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
bindingGroup = new org.jdesktop.beansbinding.BindingGroup();barraCrud = new br.com.tebosoftware.gui.componentes.BarraCrud();
tpnDados = new javax.swing.JTabbedPane();
pnlPesquisa = new javax.swing.JPanel();
painelPesquisaCliente = new br.com.tebosoftware.cliente.PainelPesquisaCliente();
pnlRegistro = new javax.swing.JPanel();
tpnRegistro = new javax.swing.JTabbedPane();
pnlGeral = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
txtNome = new javax.swing.JTextField();
jLabel14 = new javax.swing.JLabel();
tdpCadastro = new br.com.tebosoftware.gui.componentes.TeboDatePicker();
painelEndereco = new br.com.tebosoftware.endereco.PainelEndereco();
jPanel3 = new javax.swing.JPanel();
jLabel15 = new javax.swing.JLabel();
jLabel16 = new javax.swing.JLabel();
txtSite = new javax.swing.JTextField();
tdpDataNascimento = new br.com.tebosoftware.gui.componentes.TeboDatePicker();
buscaRamoAtividade = new br.com.tebosoftware.ramoAtividade.BuscaRamoAtividade();
pnlDocumentos = new javax.swing.JPanel();
chkPessoaFisica = new javax.swing.JCheckBox();
pnlPessoaFisica = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jLabel8 = new javax.swing.JLabel();
txtCpf = new javax.swing.JFormattedTextField();
jLabel10 = new javax.swing.JLabel();
txtRG = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
txtRGOrgao = new javax.swing.JTextField();
beRgUf = new br.com.tebosoftware.estado.BuscaEstado();
pnlPessoaJuridica = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
txtInscricaoEstadual = new javax.swing.JTextField();
txtInscricaoMunicipal = new javax.swing.JTextField();
txtCnpj = new javax.swing.JFormattedTextField();
jLabel11 = new javax.swing.JLabel();
pnlInfoBanc = new javax.swing.JPanel();
jLabel24 = new javax.swing.JLabel();
txtConta = new javax.swing.JTextField();
buscaBanco = new br.com.tebosoftware.banco.BuscaBanco();
txtDigito = new javax.swing.JTextField();
jLabel22 = new javax.swing.JLabel();
jLabel23 = new javax.swing.JLabel();
txtAgencia = new javax.swing.JTextField();
pnlContatos = new javax.swing.JPanel();
painelContatos = new br.com.tebosoftware.pessoa.PainelContatos();
pnlEnderecos = new javax.swing.JPanel();
painelOutrosEnderecos = new br.com.tebosoftware.pessoa.PainelOutrosEnderecos();
pnlObservacao = new javax.swing.JPanel();
jLabel17 = new javax.swing.JLabel();
jScrollPane3 = new javax.swing.JScrollPane();
tarObservacao = new javax.swing.JTextArea();setLayout(new java.awt.BorderLayout());
add(barraCrud, java.awt.BorderLayout.NORTH);pnlPesquisa.setLayout(new java.awt.BorderLayout());
pnlPesquisa.add(painelPesquisaCliente, java.awt.BorderLayout.CENTER);tpnDados.addTab(“Pesquisa”, pnlPesquisa);
pnlRegistro.setLayout(new java.awt.BorderLayout());
pnlGeral.setLayout(new java.awt.GridBagLayout());
jPanel1.setLayout(new java.awt.GridBagLayout());
jLabel5.setText(“Nome:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel1.add(jLabel5, gridBagConstraints);txtNome.setColumns(50);
org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.razaoSocial}"), txtNome, org.jdesktop.beansbinding.BeanProperty.create(“text”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), txtNome, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel1.add(txtNome, gridBagConstraints);jLabel14.setText(“Data cadastro:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel1.add(jLabel14, gridBagConstraints);binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.dataCadastro}"), tdpCadastro, org.jdesktop.beansbinding.BeanProperty.create(“data”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), tdpCadastro, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel1.add(tdpCadastro, gridBagConstraints);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
pnlGeral.add(jPanel1, gridBagConstraints);binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), painelEndereco, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.endereco}"), painelEndereco, org.jdesktop.beansbinding.BeanProperty.create(“endereco”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
pnlGeral.add(painelEndereco, gridBagConstraints);jPanel3.setLayout(new java.awt.GridBagLayout());
jLabel15.setText(“Data nascimento:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel3.add(jLabel15, gridBagConstraints);jLabel16.setText(“Site:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel3.add(jLabel16, gridBagConstraints);txtSite.setColumns(50);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.site}"), txtSite, org.jdesktop.beansbinding.BeanProperty.create(“text”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), txtSite, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel3.add(txtSite, gridBagConstraints);binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.dataNascimento}"), tdpDataNascimento, org.jdesktop.beansbinding.BeanProperty.create(“data”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), tdpDataNascimento, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.FIRST_LINE_START;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel3.add(tdpDataNascimento, gridBagConstraints);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
pnlGeral.add(jPanel3, gridBagConstraints);binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), buscaRamoAtividade, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.ramoAtividade}"), buscaRamoAtividade, org.jdesktop.beansbinding.BeanProperty.create(“ramoAtividade”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
pnlGeral.add(buscaRamoAtividade, gridBagConstraints);tpnRegistro.addTab(“Geral”, pnlGeral);
pnlDocumentos.setLayout(new java.awt.GridBagLayout());
chkPessoaFisica.setText(“Pessoa Física?”);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.pessoaFisica}"), chkPessoaFisica, org.jdesktop.beansbinding.BeanProperty.create(“selected”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), chkPessoaFisica, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlDocumentos.add(chkPessoaFisica, gridBagConstraints);pnlPessoaFisica.setBorder(javax.swing.BorderFactory.createTitledBorder(“Pessoa Física”));
pnlPessoaFisica.setLayout(new java.awt.GridBagLayout());jPanel2.setLayout(new java.awt.GridBagLayout());
jLabel8.setText(“Cpf:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel2.add(jLabel8, gridBagConstraints);txtCpf.setColumns(11);
txtCpf.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter()));binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.cpf}"), txtCpf, org.jdesktop.beansbinding.BeanProperty.create(“value”));
binding.setConverter(new CpfConversor());
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${editando and pessoaFisica}"), txtCpf, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel2.add(txtCpf, gridBagConstraints);jLabel10.setText(“RG:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel2.add(jLabel10, gridBagConstraints);txtRG.setColumns(10);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.rg}"), txtRG, org.jdesktop.beansbinding.BeanProperty.create(“text”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${editando and pessoaFisica}"), txtRG, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel2.add(txtRG, gridBagConstraints);jLabel13.setText(“RG Orgão:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel2.add(jLabel13, gridBagConstraints);txtRGOrgao.setColumns(10);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.rgOrgao}"), txtRGOrgao, org.jdesktop.beansbinding.BeanProperty.create(“text”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${editando and pessoaFisica}"), txtRGOrgao, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
jPanel2.add(txtRGOrgao, gridBagConstraints);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
pnlPessoaFisica.add(jPanel2, gridBagConstraints);beRgUf.setTitulo(“RG UF:”);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${editando and pessoaFisica}"), beRgUf, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.rgUF}"), beRgUf, org.jdesktop.beansbinding.BeanProperty.create(“estado”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
pnlPessoaFisica.add(beRgUf, gridBagConstraints);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
pnlDocumentos.add(pnlPessoaFisica, gridBagConstraints);pnlPessoaJuridica.setBorder(javax.swing.BorderFactory.createTitledBorder(“Pessoa Jurídica”));
pnlPessoaJuridica.setLayout(new java.awt.GridBagLayout());jLabel9.setText(“Cnpj:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlPessoaJuridica.add(jLabel9, gridBagConstraints);jLabel12.setText(“Inscrição Municipal:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlPessoaJuridica.add(jLabel12, gridBagConstraints);txtInscricaoEstadual.setColumns(15);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${editando and not pessoaFisica}"), txtInscricaoEstadual, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlPessoaJuridica.add(txtInscricaoEstadual, gridBagConstraints);txtInscricaoMunicipal.setColumns(15);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${editando and not pessoaFisica}"), txtInscricaoMunicipal, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlPessoaJuridica.add(txtInscricaoMunicipal, gridBagConstraints);txtCnpj.setColumns(14);
txtCnpj.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter()));binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.cnpj}"), txtCnpj, org.jdesktop.beansbinding.BeanProperty.create(“value”));
binding.setConverter(new CnpjConversor());
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${editando and not pessoaFisica}"), txtCnpj, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlPessoaJuridica.add(txtCnpj, gridBagConstraints);jLabel11.setText(“Inscrição Estadual:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlPessoaJuridica.add(jLabel11, gridBagConstraints);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
pnlDocumentos.add(pnlPessoaJuridica, gridBagConstraints);tpnRegistro.addTab(“Documentos”, pnlDocumentos);
pnlInfoBanc.setLayout(new java.awt.GridBagLayout());
jLabel24.setText(“DV:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlInfoBanc.add(jLabel24, gridBagConstraints);txtConta.setColumns(10);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.informacaoBancaria.conta}"), txtConta, org.jdesktop.beansbinding.BeanProperty.create(“text”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), txtConta, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.ipadx = 80;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlInfoBanc.add(txtConta, gridBagConstraints);buscaBanco.setPreferredSize(new java.awt.Dimension(200, 40));
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${banco}"), buscaBanco, org.jdesktop.beansbinding.BeanProperty.create(“banco”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), buscaBanco, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridheight = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
pnlInfoBanc.add(buscaBanco, gridBagConstraints);txtDigito.setColumns(1);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.informacaoBancaria.digito}"), txtDigito, org.jdesktop.beansbinding.BeanProperty.create(“text”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), txtDigito, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlInfoBanc.add(txtDigito, gridBagConstraints);jLabel22.setText(“Agência:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlInfoBanc.add(jLabel22, gridBagConstraints);jLabel23.setText(“Conta:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlInfoBanc.add(jLabel23, gridBagConstraints);txtAgencia.setColumns(5);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.entidade.informacaoBancaria.agencia}"), txtAgencia, org.jdesktop.beansbinding.BeanProperty.create(“text”));
bindingGroup.addBinding(binding);
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), txtAgencia, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.ipadx = 40;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlInfoBanc.add(txtAgencia, gridBagConstraints);tpnRegistro.addTab(“Informações Bancárias”, pnlInfoBanc);
pnlContatos.setLayout(new java.awt.BorderLayout());
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), painelContatos, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);pnlContatos.add(painelContatos, java.awt.BorderLayout.CENTER);
tpnRegistro.addTab(“Contatos”, pnlContatos);
pnlEnderecos.setLayout(new java.awt.BorderLayout());
binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), painelOutrosEnderecos, org.jdesktop.beansbinding.BeanProperty.create(“enabled”));
bindingGroup.addBinding(binding);pnlEnderecos.add(painelOutrosEnderecos, java.awt.BorderLayout.CENTER);
tpnRegistro.addTab(“Outros Endereços”, pnlEnderecos);
pnlObservacao.setLayout(new java.awt.GridBagLayout());
jLabel17.setText(“Observação:”);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlObservacao.add(jLabel17, gridBagConstraints);tarObservacao.setColumns(50);
tarObservacao.setRows(5);binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, this, org.jdesktop.beansbinding.ELProperty.create("${controlador.editando}"), tarObservacao, org.jdesktop.beansbinding.BeanProperty.create(“editable”));
bindingGroup.addBinding(binding);jScrollPane3.setViewportView(tarObservacao);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
pnlObservacao.add(jScrollPane3, gridBagConstraints);tpnRegistro.addTab(“Observação”, pnlObservacao);
pnlRegistro.add(tpnRegistro, java.awt.BorderLayout.PAGE_START);
tpnDados.addTab(“Registro”, pnlRegistro);
add(tpnDados, java.awt.BorderLayout.CENTER);
bindingGroup.bind();
}// </editor-fold>
// Variables declaration - do not modify
private br.com.tebosoftware.gui.componentes.BarraCrud barraCrud;
private br.com.tebosoftware.estado.BuscaEstado beRgUf;
private br.com.tebosoftware.banco.BuscaBanco buscaBanco;
private br.com.tebosoftware.ramoAtividade.BuscaRamoAtividade buscaRamoAtividade;
private javax.swing.JCheckBox chkPessoaFisica;
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 jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane3;
private br.com.tebosoftware.pessoa.PainelContatos painelContatos;
private br.com.tebosoftware.endereco.PainelEndereco painelEndereco;
private br.com.tebosoftware.pessoa.PainelOutrosEnderecos painelOutrosEnderecos;
private br.com.tebosoftware.cliente.PainelPesquisaCliente painelPesquisaCliente;
private javax.swing.JPanel pnlContatos;
private javax.swing.JPanel pnlDocumentos;
private javax.swing.JPanel pnlEnderecos;
private javax.swing.JPanel pnlGeral;
private javax.swing.JPanel pnlInfoBanc;
private javax.swing.JPanel pnlObservacao;
private javax.swing.JPanel pnlPesquisa;
private javax.swing.JPanel pnlPessoaFisica;
private javax.swing.JPanel pnlPessoaJuridica;
private javax.swing.JPanel pnlRegistro;
private javax.swing.JTextArea tarObservacao;
private br.com.tebosoftware.gui.componentes.TeboDatePicker tdpCadastro;
private br.com.tebosoftware.gui.componentes.TeboDatePicker tdpDataNascimento;
private javax.swing.JTabbedPane tpnDados;
private javax.swing.JTabbedPane tpnRegistro;
private javax.swing.JTextField txtAgencia;
private javax.swing.JFormattedTextField txtCnpj;
private javax.swing.JTextField txtConta;
private javax.swing.JFormattedTextField txtCpf;
private javax.swing.JTextField txtDigito;
private javax.swing.JTextField txtInscricaoEstadual;
private javax.swing.JTextField txtInscricaoMunicipal;
private javax.swing.JTextField txtNome;
private javax.swing.JTextField txtRG;
private javax.swing.JTextField txtRGOrgao;
private javax.swing.JTextField txtSite;
private org.jdesktop.beansbinding.BindingGroup bindingGroup;
// End of variables declaration@Override
public String getTitulo() {
return TITULO;
}@Override
public boolean isPodeFechar() {
return !controlador.isEditando();
}@Override
public void setFecharAction(ActionListener event) {
barraCrud.fecharAction(event);
}@Override
public Component getComponent() {
return this;
}
}
[/code] -
desde já agradeço