netbeans6.28项目总结

项目:货物管理系统

功能:修改,查询

问题:

如何将在表格中显示的数据当鼠标点击哪一行时,在文本框中进行显示?

首先将表格的事件设为鼠标点击事件

1.先获取哪一行

int selRow = this.tblProduct.getSelectedRow();//获取行

2.分别获取该行的每一列

如果该列为int属性

 this.txtId.setText(this.tblProduct.getValueAt(selRow, 0).toString());

如果该列为string类型

this.txtName.setText((String) this.tblProduct.getValueAt(selRow, 1));
        this.txtType.setText((String) this.tblProduct.getValueAt(selRow, 2));
        this.txtColor.setText((String) this.tblProduct.getValueAt(selRow, 3));

项目四天:增删改查四个功能

总结

1.将数据库连接写为工具类,数据的输入写为工具类,将工具类保存方便以后使用

2.增加时判断是否有重复的数据,如果是库存的话,则在原来数据的基础上增加库存



猜你喜欢

转载自blog.csdn.net/hewenjing8168/article/details/80847641
今日推荐