0
我想在我的jcombobox 中选定的项目填充我的jtable下面是我写的代码来执行操作,但它没有。如何根据我在JComboBox中点击的项目更新Jtable?
请在Java中仍然是新的,所以我会欣赏帮助。
if(AssetCategories.getSelectedItem() == "LAND & BUILDINGS"){
try {
String sql = "SELECT Description FROM items where Description_Code = 'LB' Order by id";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
dep_report.setModel(DbUtils.resultSetToTableModel(rs));
} catch (SQLException ex) {
Logger.getLogger(DepreciationReport.class.getName()).log(Level.SEVERE, null, ex);
}
}
将'=='更改为'equals()'为最小值。 – alex2410
[crossposted](http://www.daniweb.com/software-development/java/threads/468398/how-to-update-jtable-based-on-the-items-i-click-in-my-jcombobox ) – mKorbel
谢谢alex2410 – Sarkwa