gpt4 book ai didi

java - JFrame 中自动建议的组合框

转载 作者:行者123 更新时间:2023-12-02 00:32:16 25 4
gpt4 key购买 nike

我使用以下代码将数据检索到组合框中。如何将 Jcombobox 更改为自动建议的组合框。这意味着当我按 A 时,以 A 开头的单词将显示在组合框中的项目字段中。

public void combo(){

try{
GCS.GContnStr();
TmpFlxTSt= GCS.GCotnStr.createStatement();
String select = "Select StudName from studentmaster";
TmpFlxTRs = TmpFlxTSt.executeQuery(select);

while(TmpFlxTRs.next())
{
String TmpOb1=TmpFlxTRs.getString("StudName");
TmpOb1.toString();
cbx.addItem(TmpOb1);
cbx.setMaximumRowCount(1);

}

最佳答案

尝试使用包 org.jdesktop.swingx.autocomplete 中的 Combobox 组件, maven 存储库 here

关于java - JFrame 中自动建议的组合框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8711188/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com