> "The trouble is, the JTable is only displaying the first element in
> rowData."
[quoted text clipped - 45 lines]
>
> table = new JTable(rowData, colNames);
JTable automatically creates model as DefaultTableModel
You may replace it with
DefaultTableModel model = new DefaultTableModel(rowData, colNames);
table = new JTable(model);
> sp = new JScrollPane(table);
>
[quoted text clipped - 8 lines]
>
> TableModel model = new AbstractTableModel( );
Impossible!!! AbstractTableModel is ABSTRACT
> table = new JTable(model);
> sp = new JScrollPane(table);
>
> But how do I feed the two Vectors to the model and how do I update it
> later? I'm just not sure this will help me as I don't really know
> where my problem lies.
Create your own model subclassing AbstractTableModel or use
DefaultTableModel that designed for keeping data as Vector of Vectors
> Any help or advice would be appreciated.
> Urraco
>
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
Urraco - 01 Feb 2006 23:00 GMT
Thanks for your help. Although the problem lied not in my lack of using
a TableModel of sorts, but the way I was trying to update the table.
My table is not being edited so a TableModel doesn't help me. Only the
data model was being updated. When I called table.revalidate( ) at an
earlier point, I was receiving a null error. It was true the table
wasn't created at the point yet. I just didn't see it with the way I
had my classes separated. In the end, table.revalidate( ) did the trick
and my problem is solved.
Looking back, the table should have updated itself when the data
changed. However, I think that using a for loop and updating the data
model repeatedly in quick succession, the JVM couldn't keep up with the
calls to update the table. After all why would the JTable only display
the first element in the data model when there were many others? That
would be my best guess. Any others?
Thanks again
Urraco