Read data from a JTable created from AbstractTableModel

If you have a JTable in Java created with an AbstractTableModel, you can read the data from it, using following:

int rowCount = testTable.getRowCount();
for (int i = 0; i < rowCount; i++) {
   String mColumn1 = (String) testTable.getModel().getValueAt(i, 0);
   String mColumn2 = (String) testTable.getModel().getValueAt(i, 1);
}

Alternatively, you could also try where the JTable is within a Panel:

int rowCount = testTable.getRowCount();
for (int i = 0; i < rowCount; i++) {
   JTable myTable = myPanel.testTable;           //<-----

   String mColumn1 = (String) myTable.getModel().getValueAt(i, 0);
   String mColumn2 = (String) myTable.getModel().getValueAt(i, 1);
}