我尝试在 jtable 中选中复选框后在 jlabel 中显示项目数量的较低值,该复选框已经由 sql 查询填充,通过单击 jbutton,这些值将显示在 jlabel 中。
我已经尝试列出所选项目以在 jlabel 中显示较低的项目数量。
private void ButtonbtActionPerformed(java.awt.event.ActionEvent evt) {
try {
PreparedStatement ps = DataBase.mycon().prepareStatement("select (sum(`Item Available Qty`)/Qty) as available,"
+ "`Check` from a where `Part No` is not null and `Check` !='1'"
+"group by `Part No` order by (sum(`Item Available Qty`)/Qty) limit 1");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
String product = rs.getString("available");
BOMProductsL.setText(product);
}
ps.close();
DataBase.mycon().close();
} catch (SQLException e) {
e.printStackTrace();
JOptionPane.showMessageDialog(null, "Product loading error");
}
}
点击按钮的预期输出
我通过点击按钮获得输出