-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Combobox control is only displaying 10 data items at any time.
<combobox id="monthCbId" width="100px" />
monthList = new ArrayList<String>(13);
monthList.add("Select");
monthList.add("JAN");
monthList.add("FEB");
monthList.add("MAR");
monthList.add("APR");
monthList.add("MAY");
monthList.add("JUN");
monthList.add("JUL");
monthList.add("AUG");
monthList.add("SEP");
monthList.add("OCT");
monthList.add("NOV");
monthList.add("DEC");
ListModel monModel = new SimpleListModel(monthList);
monthCbId.setModel(monModel);
But the combobox is only displaying items until SEP. Is there any property so that it will display all the items in the listmodel.
Thanks,
Maruthi
You have to write your own model(not to use simpleListModel beacause it only supports for 10 rows)
the limit is the "nRows" in the getSubModel method(in simpleListModel)
Ps:When syncModel method be called it always pass nRows=-1 to getSubModel method.
public ListModel getSubModel(Object value, int nRows) { final String idx = value == null ? "" : objectToString(value); if (nRows < 0) nRows = 10; final LinkedList data = new LinkedList(); for (int i = 0; i < _data.length; i++) { if (idx.equals("") || _data<i >.toString().startsWith(idx)) { data.add(_data<i >); if (--nRows <= 0) break; //done } } return new SimpleListModel(data); }
Asked: 2009-04-13 15:18:28 +0800
Seen: 622 times
Last updated: Apr 14 '09