swing - ComboBox, Automatic filling. Java -
i have shopping cart records how many orders have been made using :
int ordernumber
, just ++
when ever new order made, want add edit function click on edit button , open new frame select order want edit via combobox, problem need combobox fill 1,2,3 etc... depending on how many orders made. had go @ achieving method below errors.
ordernumberslist = new string[ordernumber]; (int = 1; <= ordernumber; i++) { ordernumberslist[i] = "" + i; } jcombobox ordernumberbox = new jcombobox(ordernumberslist);
arrays 0 based. replace
for (int = 1; <= ordernumber; i++) { ordernumberslist[i] = "" + i; }
with
for (int = 0; < ordernumber; i++) { ordernumberslist[i] = integer.tostring(i + 1); }
notice assigned value i
adjusted
Comments
Post a Comment