Sorting Combo Box Items

This post has been deleted


Um : I don’t understand - you talk about “sorting combo box items”, yet the code you give will present the combo box items in the same order that you present them → The combo box will be sorted correctly.

However, you say :

That’s a completely different issue, and has nothing to do with sorting; the reason that the last item is getting selected is because you are programatically selecting it, by calling currency.setValue(currencyView.getName())! Take that call out of the loop, and nothing will be selected (and the user will have to select an item themselves.

Of course, if you want to select the first item, that’s also possible.

    //Add currencies into the combo box
    ArrayList<CurrencyView> ccyView = new ArrayList<CurrencyView>();
    ccyView = serviceWrapper .getCurrencyDataList(null);

    for (Iterator<? extends CurrencyView> currencyIterator = ccyView .iterator(); currencyIterator.hasNext();) {
        currencyView =;

    // Select first currency (if there is one)
    Object id = currencyField.getItemIds().iterator().next();
    if (id != null) {