Hey all,
I have a serious problem with getting my Jtable to display. It only displays the column names - not the data. The data is being derived from a result set (JDBC) - I know that that, at least, is working fine.
The Jtable uses the DefaultTableModel, and is displayed inside an internal window of the application.
Heres the relevant code:
public class SQL_Statements
{
public Vector getDescription()
{
try
{
SQL = "SELECT Description FRO Job_In_Info";
query_results = s.executeQuery(SQL);
while(query_results.next())
{
v.add(query_results.getString(1));
}
}
catch(SQLException e)
{
System.err.println("SQL Exception: " + e);
System.exit(0);
}
return v;
}
//The getDescription code works fine
, i.e. System.out.println(v.lastElement()); produces whats it's meant to produce!
....
....
The main code is here:
SQL_Statements SQL;
JInternalFrame in = new JInternalFrame();
//Internal window named IN
Container contentPane = in.getContentPane();
DefaultTableModel defaultModel = new DefaultTableModel();
defaultModel.addColumn("Description", SQL.getDescription());
//addColumn susposedly has the following parameters addColumn(object column name, vector data);
JTable table = new JTable(defaultModel);
JScrollPane scroller = new JScrollPane(table);
contentPane.add(scroller);
//Note: The program uses internal windows. Could that be part of the problem?
...
...
Thast all the Jtable relevant code. Any ideas why the column name but not the data are displaying?