Boa Tarde Pessoal
Então meu problema é simples, tenho um JCombobox com Condomínios.
Ao clicar em um item ele deve carregar outro JCombobox dos Imóveis daquele Condomínio Selecionado.
Segue o código abaixo
Controller
@Override
public void itemStateChanged(ItemEvent e) {
Component component = (Component) e.getSource();
EntityCondominio entityCondominio = new EntityCondominio();
List<EntityImovel> col = new ArrayList<EntityImovel>();
JComboBox jComboCondominio = new JComboBox();
if(component.getName().equals("jComboCondominio")) {
jComboCondominio = (JComboBox) component;
entityCondominio = DAOFactory.getInstance().getCondominioDAO().findByNome(jComboCondominio.getSelectedItem().toString());
col = DAOFactory.getInstance().getImovelDAO().findByCondominio(entityCondominio);
}
for(EntityImovel item: col) {
System.out.println(item.getNumero());
}
Tela
...
jComboCondominio.addActionListener(controlPagamento);
jComboCondominio.addItemListener(controlPagamento);
jComboCondominio.setName("jComboCondominio");
jComboMes.addActionListener(controlPagamento);
jComboMes.setName("jComboMes");
jComboImovel.addActionListener(controlPagamento);
jComboImovel.addItemListener(controlPagamento);
jComboImovel.setName("jComboImovel");
...
Eu fiz o Debug aqui e não entendo o pq ao selecionar um item no JCombobox do Condominio
ele não caí no método itemStateChanged mas caí no actionPerformed
Agradeço desde já a ajuda