I using detaful table model
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
and I row count
int Row = model.getRowCount();
Here is which I add row and wish to diplay error when adding same items.
if (Row > 0) {
for(i=0;i<Row; i++){
if(jTable1.getValueAt(i,0).equals(name.getText())){
JOptionPane.showMessageDialog(null, "Can't add same item");
}
}
}else if (Row <99) {
model.addRow(new Object[] {name.getText(),address.getText(),Integer.parseInt(age.getText())});
}
I guess wrong at if else statement? Because I can add the 1st row and I can't add for 2nd row.
Thanks for help