Chegue e fiz o teste, mas ficou uma critica de erro no código, segue as classes com o código que fiz:
Classe BeansEspecialidade.
public class BeansEspecialidade {
private int codigo;
private String especialidade;
private String pesquisa;
public BeansEspecialidade(BeansEspecialidade especialidade, int codigo) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
/**
* @return the codigo
*/
public int getCodigo() {
return codigo;
}
/**
* @param codigo the codigo to set
*/
public void setCodigo(int codigo) {
this.codigo = codigo;
}
/**
* @return the especialidade
*/
public String getEspecialidade() {
return especialidade;
}
/**
* @param especialidade the especialidade to set
*/
public void setEspecialidade(String especialidade) {
this.especialidade = especialidade;
}
/**
* @return the pesquisa
*/
public String getPesquisa() {
return pesquisa;
}
/**
* @param pesquisa the pesquisa to set
*/
public void setPesquisa(String pesquisa) {
this.pesquisa = pesquisa;
}
}
Classe TelaCadMedicos
public class TelaCadMedicos extends javax.swing.JFrame {
BeansMedico mod = new BeansMedico();
private List<BeansEspecialidade> especialidades = new ArrayList<>();
DaoMedico control = new DaoMedico();
ConexaoBD conex = new ConexaoBD();
int flag = 0;
public TelaCadMedicos() {
initComponents();
preencherEspecialidade();
preencherCidade();
preencherBairro();
bgSexo = new ButtonGroup();
bgSexo.add(rbMasculino);
bgSexo.add(rbFeminino);
bgStatus = new ButtonGroup();
bgStatus.add(rbAtivo);
bgStatus.add(rbInativo);
}
/**
* 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() {
bgSexo = new javax.swing.ButtonGroup();
bgStatus = new javax.swing.ButtonGroup();
jpCadMedicos = new javax.swing.JPanel();
jlbCadMedicos = new javax.swing.JLabel();
jlbIdMedico = new javax.swing.JLabel();
jlbNomeMedico = new javax.swing.JLabel();
jlbRgMedico = new javax.swing.JLabel();
jlbCpfMedico = new javax.swing.JLabel();
jlbCrmMedico = new javax.swing.JLabel();
jlbEspecialidade = new javax.swing.JLabel();
jlbSexo = new javax.swing.JLabel();
jlbStatusMedico = new javax.swing.JLabel();
jlbRua = new javax.swing.JLabel();
jlbBairro = new javax.swing.JLabel();
jlbCidade = new javax.swing.JLabel();
jlbNumEndereco = new javax.swing.JLabel();
jlbComplemento = new javax.swing.JLabel();
jlbTelefone = new javax.swing.JLabel();
jlbCelular = new javax.swing.JLabel();
jlbEmail = new javax.swing.JLabel();
jtfIdMedico = new javax.swing.JTextField();
jtfNomeMedico = new javax.swing.JTextField();
jtfRgMedico = new javax.swing.JTextField();
jtfPesquisar = new javax.swing.JTextField();
jtfRua = new javax.swing.JTextField();
jtfNumEndereco = new javax.swing.JTextField();
jtfComplemento = new javax.swing.JTextField();
jtfEmail = new javax.swing.JTextField();
jtfCrm = new javax.swing.JTextField();
IdCidade = new javax.swing.JTextField();
IdBairro = new javax.swing.JTextField();
jcbEspecialidade = new javax.swing.JComboBox<Object>();
jcbBairro = new javax.swing.JComboBox();
jcbCidade = new javax.swing.JComboBox();
jspMedicos = new javax.swing.JScrollPane();
jtbMedicos = new javax.swing.JTable();
jbNovo = new javax.swing.JButton();
jbSalvar = new javax.swing.JButton();
jbAlterar = new javax.swing.JButton();
jbExcluir = new javax.swing.JButton();
jbPesquisar = new javax.swing.JButton();
jbCancelar = new javax.swing.JButton();
jftCpf = new javax.swing.JFormattedTextField();
jftTelefone = new javax.swing.JFormattedTextField();
jftCelular = new javax.swing.JFormattedTextField();
rbMasculino = new javax.swing.JRadioButton();
rbFeminino = new javax.swing.JRadioButton();
rbAtivo = new javax.swing.JRadioButton();
rbInativo = new javax.swing.JRadioButton();
jtfIdEspecialidade = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jpCadMedicos.setBorder(javax.swing.BorderFactory.createEtchedBorder());
jlbCadMedicos.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jlbCadMedicos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Medico40.png"))); // NOI18N
jlbCadMedicos.setText("Cadastro de Médicos");
jlbIdMedico.setText("ID");
jlbNomeMedico.setText("Nome");
jlbRgMedico.setText("RG");
jlbCpfMedico.setText("CPF");
jlbCrmMedico.setText("CRM");
jlbEspecialidade.setText("Especialida");
jlbSexo.setText("Sexo");
jlbStatusMedico.setText("Status do Médico");
jlbRua.setText("Rua");
jlbBairro.setText("Bairro");
jlbCidade.setText("Cidade");
jlbNumEndereco.setText("Número");
jlbComplemento.setText("Complemento");
jlbTelefone.setText("Telefone");
jlbCelular.setText("Celular");
jlbEmail.setText("E-mail");
jtfIdMedico.setEnabled(false);
jtfNomeMedico.setEnabled(false);
jtfRgMedico.setEnabled(false);
jtfRua.setEnabled(false);
jtfNumEndereco.setEnabled(false);
jtfComplemento.setEnabled(false);
jtfEmail.setEnabled(false);
jtfEmail.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jtfEmailActionPerformed(evt);
}
});
jtfCrm.setEnabled(false);
IdCidade.setEnabled(false);
IdBairro.setEnabled(false);
jcbEspecialidade.setEnabled(false);
jcbEspecialidade.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jcbEspecialidadeItemStateChanged(evt);
}
});
jcbBairro.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jcbBairro.setEnabled(false);
jcbCidade.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jcbCidade.setEnabled(false);
jtbMedicos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{},
{},
{},
{}
},
new String [] {
}
));
jspMedicos.setViewportView(jtbMedicos);
jbNovo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Novo16.png"))); // NOI18N
jbNovo.setText("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("/imagens/Salvar16.png"))); // NOI18N
jbSalvar.setText("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("/imagens/Alterar16.png"))); // NOI18N
jbAlterar.setText("Alterar");
jbAlterar.setEnabled(false);
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("/imagens/Excluir16.png"))); // NOI18N
jbExcluir.setText("Excluir");
jbExcluir.setEnabled(false);
jbPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Pesquisar16.png"))); // NOI18N
jbPesquisar.setText("Pesquisar");
jbCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Fechar20.png"))); // NOI18N
jbCancelar.setText("Cancelar");
jbCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jbCancelarActionPerformed(evt);
}
});
try {
jftCpf.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
jftCpf.setEnabled(false);
try {
jftTelefone.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)####-####")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
jftTelefone.setEnabled(false);
try {
jftCelular.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("(##)#####-####")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
jftCelular.setEnabled(false);
rbMasculino.setText("Masculino");
rbMasculino.setEnabled(false);
rbFeminino.setText("Feminino");
rbFeminino.setEnabled(false);
rbAtivo.setText("Ativo");
rbAtivo.setEnabled(false);
rbInativo.setText("Inativo");
rbInativo.setEnabled(false);
jtfIdEspecialidade.setEnabled(false);
javax.swing.GroupLayout jpCadMedicosLayout = new javax.swing.GroupLayout(jpCadMedicos);
jpCadMedicos.setLayout(jpCadMedicosLayout);
jpCadMedicosLayout.setHorizontalGroup(
jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jpCadMedicosLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jspMedicos)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpCadMedicosLayout.createSequentialGroup()
.addComponent(jlbCadMedicos)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jbCancelar))
.addGroup(jpCadMedicosLayout.createSequentialGroup()
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jpCadMedicosLayout.createSequentialGroup()
.addComponent(jlbEspecialidade)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfIdEspecialidade, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbEspecialidade, javax.swing.GroupLayout.PREFERRED_SIZE, 174, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbSexo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rbMasculino)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rbFeminino)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jlbStatusMedico)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rbAtivo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rbInativo))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpCadMedicosLayout.createSequentialGroup()
.addComponent(jbNovo, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbAlterar, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jbPesquisar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jpCadMedicosLayout.createSequentialGroup()
.addComponent(jlbRua)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfRua, javax.swing.GroupLayout.PREFERRED_SIZE, 313, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbNumEndereco)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfNumEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbComplemento)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfComplemento))
.addGroup(jpCadMedicosLayout.createSequentialGroup()
.addComponent(jlbBairro)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(IdBairro, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbBairro, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbCidade)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(IdCidade, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcbCidade, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(194, 194, 194)))
.addGap(0, 65, Short.MAX_VALUE))
.addGroup(jpCadMedicosLayout.createSequentialGroup()
.addComponent(jlbIdMedico)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfIdMedico, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbNomeMedico)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfNomeMedico, javax.swing.GroupLayout.PREFERRED_SIZE, 285, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbRgMedico)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfRgMedico, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbCpfMedico)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jftCpf, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbCrmMedico)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfCrm))
.addGroup(jpCadMedicosLayout.createSequentialGroup()
.addComponent(jlbTelefone)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jftTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbCelular)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jftCelular, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jlbEmail)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jtfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
);
jpCadMedicosLayout.setVerticalGroup(
jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jpCadMedicosLayout.createSequentialGroup()
.addContainerGap()
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jlbCadMedicos)
.addComponent(jbCancelar))
.addGap(18, 18, 18)
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jlbIdMedico)
.addComponent(jtfIdMedico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbNomeMedico)
.addComponent(jtfNomeMedico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbRgMedico)
.addComponent(jtfRgMedico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbCpfMedico)
.addComponent(jlbCrmMedico)
.addComponent(jftCpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jtfCrm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jlbEspecialidade)
.addComponent(jcbEspecialidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbSexo)
.addComponent(jlbStatusMedico)
.addComponent(rbMasculino)
.addComponent(rbFeminino)
.addComponent(rbAtivo)
.addComponent(rbInativo)
.addComponent(jtfIdEspecialidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jlbRua)
.addComponent(jtfRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbNumEndereco)
.addComponent(jtfNumEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbComplemento)
.addComponent(jtfComplemento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jlbBairro)
.addComponent(jcbBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbCidade)
.addComponent(jcbCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(IdCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(IdBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jtfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbTelefone)
.addComponent(jlbCelular)
.addComponent(jftTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jftCelular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlbEmail))
.addGap(18, 18, 18)
.addComponent(jspMedicos, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jpCadMedicosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jbPesquisar)
.addComponent(jbExcluir)
.addComponent(jbAlterar)
.addComponent(jbSalvar)
.addComponent(jbNovo)
.addComponent(jtfPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(41, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jpCadMedicos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jpCadMedicos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
setSize(new java.awt.Dimension(872, 604));
setLocationRelativeTo(null);
}// </editor-fold>
private void preencherEspecialidade() {
conex.conexao();
conex.executaSql("select * from especialidades order by nome_especialidade");
try {
conex.rs.first();
jcbEspecialidade.removeAllItems();
jcbEspecialidade.addItem("Selecione o item");
especialidades.clear();
ResultSet rs = conex.rs;
do {
// jcbEspecialidade.addItem(conex.rs.getString(“nome_especialidade”));
} while (rs.next());
int codigo = rs.getInt(“cod_especialidade”);
String especialidade = rs.getString(“nome_especialidade”);
BeansEspecialidade especialidade = new BeansEspecialidade(especialidade, codigo);
especialidades.add(especialidade);
jcbEspecialidade.addItem(especialidade.getEspecialidade());
} catch (SQLException ex) {
JOptionPane.showMessageDialog(rootPane, "Erro ao preencher especialidades!" + ex);
}
conex.desconecta();
}
Seria desta forma mesmo?