arraylistのforループとifループに基づいてJComboboxの値を設定しようとしています。JComboBoxで結果が表示されない
//salesman=the name of the combobox
salesman = new javax.swing.JComboBox();
DefaultComboBoxModel model = new DefaultComboBoxModel();
salesman.setModel(model);
/*company is an object of Company class, that gets set with a setter method to ensure
that the gui will be pointing to the right object. and it does contains the data i want, so
i am sure that company is not the problem */
//loop tp set box list
for (Employee current : company.getArray()){
if (current instanceof Salesman) {
salesman.addItem(current.getCode());
}
}
ですが、コンボボックスは空のままです。何故ですか ?
実際には、* Salesman.getCode()。toString()*がnullを返す場合は、それほど小さくないかもしれません) –