从 jCombobox 过滤值

问题描述 投票:0回答:1

如何过滤 jcombobox 中的文本。 jComboBox 由 sql select 填充。 需要用可编辑的jcombobox进行过滤

java sql jcombobox
1个回答
0
投票
String query = "SELECT Query ";
    try {
        pst = conn.prepareStatement(query);
        rs = pst.executeQuery();
        while (rs.next()) {
            String committee = rs.getString("column_name");
            jComboBox1.addItem(column_name);
            AutoCompleteDecorator.decorate(jComboBox1);
        }

    } catch (SQLException e) {
        e.printStackTrace();
    }
© www.soinside.com 2019 - 2024. All rights reserved.