JTable根据商品下拉框的选择,更新表格当前行的内容并指定焦点

来源:互联网 发布:大数据 市场调研 编辑:程序博客网 时间:2024/05/13 21:43
/**
* 根据商品下拉框的选择,更新表格当前行的内容
*
* @return 无
*/
private synchronized void updateTable() {
Spinfo spinfo = (Spinfo) spComboBox.getSelectedItem();
int row = table.getSelectedRow();
if (row >= 0 && spinfo != null) {
table.setValueAt(spinfo.getId(), row, 1);
table.setValueAt(spinfo.getCd(), row, 2);
table.setValueAt(spinfo.getDw(), row, 3);
table.setValueAt(spinfo.getGg(), row, 4);
table.setValueAt(spinfo.getBz(), row, 5);
table.setValueAt("0", row, 6);
table.setValueAt("0", row, 7);
table.setValueAt(spinfo.getPh(), row, 8);
table.setValueAt(spinfo.getPzwh(), row, 9);
table.editCellAt(row, 6);//指定焦点所在列
}
}
0 0
原创粉丝点击