Hi guys,

I am trying to populate a JTable with data from Database, the record set works and displays the correct data, when the class is run it will produce at empty table when there should be records on it, can any one help, thanks in advance...

package project3;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class FrmInspection extends JPanel implements ActionListener{
public JPanel PnlInspection, PnlTable, PnlScore;
public JTable tableInspection, tableScores;
public JLabel lalScore, lalComment;
public Menu Test;
public InspectionList2 ins;
public JScrollPane scrollPane;

public FrmInspection(Menu M)
{
InspectionList2 L2 = new InspectionList2();
ins = L2;
Test = M;
displayForm();
displayButtons();
PnlInspection.setVisible(true);
setSize(500,200); //
Dimension dim = getToolkit().getScreenSize();//
setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);//
setVisible(true); //
tableInspection = new JTable();
tableInspection.setModel(L2);
scrollPane = new JScrollPane(tableInspection);
scrollPane.setBounds(10,10, 650,80);
PnlTable.add(scrollPane);
ListSelectionModel rowSM = tableInspection.getSelectionModel();

}
public void displayForm()
{
PnlInspection=new JPanel();
PnlInspection.setLayout(null);
PnlInspection.setBounds(150, 140, 600,300);

PnlTable = new JPanel();
PnlTable.setLayout(null);
PnlTable.setBounds(10, 10, 500, 100);
PnlInspection.add(PnlTable);

PnlScore = new JPanel();
PnlScore.setLayout(null);
PnlScore.setBounds(10, 120, 500, 100);
PnlInspection.add(PnlScore);
}
public void displayButtons()
{

}
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
}
public static void main(String[] arg) {
//FrmInspection S = new FrmInspection(Menu);
}
}

package project3;
import javax.swing.*;
import java.sql.*;
import java.util.*;
import javax.swing.table.AbstractTableModel;

public class InspectionList2 extends AbstractTableModel
{
private Connection con;

public Vector InspectList = new Vector();
private Inspection Ins;

private String[] columnNames = {"Inspection ID","Prop Ref","Date","Time","Officer","Risk","Points","Letter"};

public InspectionList2 ()
{
try
{
ConnectionMan man = ConnectionMan.getInstance();
con = man.getConnection();
getInspectionList();
}
catch (SQLException e)
{
}
}

public void getInspectionList()
{
Statement stmt;
ResultSet rs;
InspectList.clear();
try
{
stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs = stmt.executeQuery
("SELECT * FROM Food_Inspect");

while (rs.next())
{
System.out.println(rs.getString(6));
System.out.println(rs.getString(7));
InspectList.add(new Inspection(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6), rs.getInt(7), rs.getString(8)));
}

rs.close();
stmt.close();
}
catch (SQLException e)
{
}
fireTableDataChanged();
}

public int getColumnCount()
{
return columnNames.length;
}

public String getColumnName (int col)
{
return columnNames[col];
}

public int getRowCount()
{
return InspectList.size();
}

public Object getValueAt(int row, int col)
{
Inspection I = (Inspection) InspectList.get(row);
switch (col) {
case 0 :
return I.getFoodID();
case 1 :
return I.getPropRef();
case 2 :
return I.getFoodDate();
case 3 :
return I.getFoodTime();
case 4 :
return I.getOfficer();
case 5 :
return I.getRisk();
case 6 :
return I.getPoints();
case 7 :
return I.getLetterDate();
default :
return null;
}
}
public boolean isCellEditable(int row, int col)
{
return false;
}
public Inspection getInspection(int i)
{
return (Inspection)InspectList.get(i);
}
public Vector getInspectionList(int UPRN)
{
Vector Inspections = new Vector();
try
{
Statement stmt3 = con.createStatement();
ResultSet rs3 = stmt3.executeQuery("SELECT * FROM Food_Inspect");

while (rs3.next())
{
InspectList.add(new Inspection (rs3.getString(1), rs3.getString(2), rs3.getString(3), rs3.getString(4), rs3.getString(5), rs3.getString(6), rs3.getInt(7), rs3.getString(8)));
}
rs3.close();
stmt3.close();
}
catch (SQLException e)
{
}
catch(NullPointerException e)
{
}
fireTableDataChanged();
return InspectList;
}
}