If you have connected to your database, you may create JTable as follow:
class myModel extends AbstractTableModel
{
String []colNames;
String []rowData;
int colCount;
Vector data = new Vector();
//You have to pass in this class Statement
//object of your connection
Statement stmt;
public myModel(Statement stmt)
{
this.stmt = stmt;
//You mast create ResultSet and
//ResultSetMetaData object for
//receiving datas from your table
try
{
ResultSet rs = stmt.exequteQuery ("Selct * from myTable");
ResultSetMetaData rsmd = rs.getMetaData();
colCount = rsmd.getColumnCount();
colNames = new String[colCount];
for(int i=0; i<colCount; i++)
{
colNames[i] = rsmd.getColumnName(i);
}
while(rs.next())
{
rowData = new String[colCount];
for(int i=0; i<colCount; i++)
{
rowData[i]=rs.getString(i+1);
}
data.add(rowData);
rowData = null;
}
}
catch(SQLException sqle)
{System.out.println(sqle.getMessage());}
}
//Now you must overload methods from
// AbstactTableModel
public int getColumnCount()
{return colCount;}
public String getColumnName(int col)
{return colNames[col];}
public int getRowCount()
{return data.size();}
public Object getValueAt(int row, int col)
{return ((String[])(data.elementAt(row)))[col];}
}
That's all.
Now in your application you may create an object of myModel type, and when you will create a JTable object, you will pass it myMidel object as argument.
I hope it will help You and sorry for my English;