-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello
In my java code I've got some code:
Combobox combo = new Combobox();
List dict = dao.getAll();
combo.setModel(new ListModelList(dict));
combo.setReadonly(true);
cell.appendChild(combo);
Cell is where I want to put my combo. In the model are 2 objects, but when I run application there are no items in the list. What am I doing wrong?
Regards
u havent specified renderar in ur code.
If u r building combobox from java then renderar ia needed.
public class ComboitemRenderer implements ComboitemRenderer{
public void render(Comboitem comboitem, Object data) throws Exception {
dataistance= (cast to appropriate class) data;
comboitem.setLabel(dataistance.getVal1());
comboitem.setValue(dataistance.getVal2());
}
}
in ur code use
ComboitemRenderer renderer = new ComboitemRenderer ();
combo.setItemRenderer(renderer);
Hope it halps
Thanks
Jaikarthik Natarajan
Without renderer is almost OK - the label is not what I want but there is some label, but when I set the renderer on the combo situation goes bad and there is nothing displayed in the combo - but renderer is working - I can see logs from it. Why renderer removes elements from combo?
please, share us your correction
Asked: 2010-06-21 14:42:29 +0800
Seen: 727 times
Last updated: Jun 23 '10