javax.swing.JTable中;记录验证原因性能问题
我试图使用for循环验证来自JTable的每个记录,当JTable有很多记录时,它需要花费很多时间,请建议我更好的方法。
请在下面找到示例代码段。谢谢提前。
JTable tblReceipt = getTblReceive();
tblReceipt.removeEditor();
boolean allLineCheck = true;
for (int row = 0; row < tblReceipt.getRowCount(); row++)
{
String issueQty = (String) tblReceipt.getValueAt(row, 5);
String receiveQty = (String) tblReceipt.getValueAt(row, 6);
String itemNo = (String) tblReceipt.getValueAt(row, 0);
double dIssueQty = Common.toDouble(issueQty);
double dReceiveQty = Common.toDouble(receiveQty);
double qty = 1.0;// initial one quantity
qty = qty / Math.pow(10, itmDecimal);
if (dReceiveQty > dIssueQty)
{
getProgressBar().setVisible(false);
Common.displayConfirmDialog()
// Qty exceeds the available qty
}
else if (itmDecimal == 0 && (dReceiveQty >= 0.0000001 && dReceiveQty <= 0.1))
{
Common.displayConfirmDialog();
// Invalid quantity
return false;
}
}