Combobox with null value

0

I have a window to insert a product into my database, in it I have 3 combobox , 2 of them work normally. But one of them that is the suppliers, which is the same as the others, the time I click on the arrow appears the list with the appropriate suppliers, but when I click on any of the list, it does not select the combobox is still empty and at the time of saving, it saves as null.

protected JComboBox<Fornecedor> cbf; 
protected JComboBox<Marca> cbMarca;

cbMarca = new JComboBox<Marca>();

for (Marca m : marcas)
    cbMarca.addItem(m);

cbMarca.setSelectedIndex(-1);
cbMarca.setBounds(500, 40, 130, 25);
panel.add(cbMarca);

cbf = new JComboBox<Fornecedor>();

for(Fornecedor f : fornecedores)
    cbf.addItem(f);

cbf.setSelectedIndex(-1);
cbf.setBounds(10, 160, 130, 25);
panel.add(cbf);
    
asked by anonymous 27.04.2015 / 02:21

0 answers