public void createTable(Show show1, Client client1){ try{ int numColumns = show1.resultsMetaData.getColumnCount(); // numColumns starts at index 1, not 0 as it is no array but no. of elements! for (int cc=1; cc<=numColumns; cc++){ String cName = show1.resultsMetaData.getColumnName(cc); columnName.add(cName); this.setColumnIdentifiers(columnName); } /* * running through the resultset, column by column and saving each cell's * value in a vector */ while(show1.rs.next()){ for (int i=1; i<=numColumns; i++){ String cellValue = show1.rs.getString(i); data.add(cellValue); } this.addRow(data); } client1.resultTable.setModel(this); client1.resultTable.isCellEditable(1, 1); } catch(Exception e){ System.out.println(e); }} // end createTable