jtable无法显示来自jcombobox的过滤器请求

时间:2018-07-29 13:37:58

标签: java sql

我有一个可以分类的物品清单。类别类型在数据库表中,并且jcomboCategory显示它们:代码如下:

import pandas as pd

filename="https://archive.ics.uci.edu/ml/machine-learning- 
databases/autos/imports-85.data"

hs = ["symboling","normalized-losses","make","fuel-type","aspiration", 
   "num-of-doors","body-style", "drive-wheels","engine-location","wheel-base", "length","width","height","curb-weight","engine-type", "num-of-cylinders", "engine-size","fuel-system","bore","stroke","compression-ratio","horsepower",
     "peak-rpm","city-mpg","highway-mpg","price"]

df = pd.read_csv(filename, names=hs)
print("Done")
df.head()

我想要一种情况,当从“ jcomboCategory”中选择类别类型时,库存表应该过滤记录以仅显示该所选类别的记录。这是我到目前为止编写的内容,但是当选择一个类别时什么也没有发生来自“ jcomboCategory”。

try{
    String sql = "select Category from ItemCategories";
    pst=con.prepareStatement(sql);
    rs = pst.executeQuery();
    while(rs.next()){
    String cat = rs.getString("Category");
    jcomboCategory.addItem(cat);
    }
    }catch(Exception e){
    JOptionPane.showMessageDialog(null, e);
    }
    finally{
            try{
                rs.close();
                pst.close();
            }
            catch(Exception e){
            }
        } 

请问我在做什么错了?

0 个答案:

没有答案