我对java很陌生,我正在开发一个库存管理系统(这是我的第一个项目)。我想在创建新行时添加列值。请任何人帮助我如何做到这一点..我想对总行求和并将其显示为箭头所在的位置。.这是我的表格数据代码。
int quantity, price;
Product p = new Product();
String[] result = new String[8];
String data[] = new String[7];
int i = 0;
result=p.getInfo(this.addItemField.getText());
for (String s : result) {
data[i] = s;
i += 1;
}
data[0] = "1";
quantity = Integer.parseInt(data[0]);
price = Integer.parseInt(data[5]);
int tPrice = price*quantity;
data[6] = Integer.toString(tPrice); //this is the field which i want to add for all row.
table.addRow(data);
this.addItemField.grabFocus();
addItemField.setText("");