失去了对SwingX JCOMBO BOX的关注

时间:2017-07-20 14:09:39

标签: java swingx

我想实现我面临的AutoSuggest ComboBox 2问题 第一次获取id和name的数组都只需要名称。 Array i am receiving 第二次失去了对键入文本的关注。

请帮忙

数据库查询

public SentenceList getAutoProductList() {
    return new StaticSentence(s, "SELECT "
            + "P.ID, "
            + "P.REFERENCE, "
            + "P.CODE, "
            + "P.CODETYPE, "
            + "P.NAME, "
            + "P.PRICEBUY, "
            + "P.PRICESELL, "
            + "P.CATEGORY, "
            + "P.TAXCAT, "
            + "P.ATTRIBUTESET_ID, "
            + "P.STOCKCOST, "
            + "P.STOCKVOLUME, "
            + "P.IMAGE, "
            + "P.ISCOM, "
            + "P.ISSCALE, "
            + "P.ISKITCHEN, "
            + "P.PRINTKB, "
            + "P.SENDSTATUS, "
            + "P.ISSERVICE, "
            + "P.ATTRIBUTES, "
            + "P.DISPLAY, "
            + "P.ISVPRICE, "
            + "P.ISVERPATRIB, "
            + "P.TEXTTIP, "
            + "P.WARRANTY, "
            + "P.STOCKUNITS "
            + "FROM PRODUCTS P "
            + "ORDER BY NAME", null, ProductInfoExt.getSerializerRead());
}

自动完成JcomboBox代码

SentenceList sentProductNames = dlSales.getAutoProductList();
    m_JComboProductName.setEditable(true);
    ComboBoxValModel m_jProductNameModel = new ComboBoxValModel();
    editor = (JTextComponent) m_JComboProductName.getEditor().getEditorComponent();

    List productList = null;
    try {
        productList = sentProductNames.list();
    } catch (Exception e) {

    }
    productList.add(0, null);
    m_jProductNameModel = new ComboBoxValModel(productList);

    m_JComboProductName.setModel(m_jProductNameModel);
    AutoCompleteDecorator.decorate(m_JComboProductName);
    System.out.println("product List "+ productList);
    if(m_JComboProductName.getItemCount()>0){
        m_JComboProductName.setSelectedIndex(0);
    }

0 个答案:

没有答案