A table should represent a collection of something. If you want a bid
table, create a TableModel that contains a set of bids and override the
required methods of TableModel.
If you want 24 rows and 2 columns (min/max) then return 2 for column
count, and 24 for row count, and create the appropriate algorithm to
determine the getValueAt for each of the 24*2 cells.
> A table should represent a collection of something. If you want a bid
> table, create a TableModel that contains a set of bids and override the
[quoted text clipped - 3 lines]
> count, and 24 for row count, and create the appropriate algorithm to
> determine the getValueAt for each of the 24*2 cells.
I'm perfectly aware of that.
What I was asking, is:
From a design perspective, when a table is going to
show multiple datasets, is it best to:
* Have one single tablemodel for the table, and change the underlying
dataset for the Model?
or...
* Have one tablemodel for each dataset, and change the model for
the table?

Signature
Dag.
Bryan Cooper - 09 Jan 2005 18:10 GMT
>> A table should represent a collection of something. If you want a bid
>> table, create a TableModel that contains a set of bids and override the
[quoted text clipped - 18 lines]
> * Have one tablemodel for each dataset, and change the model for
> the table?
>Do I put a datamodel into each bid, and use
>table.setModel(bid.model), or do I use a single datamodel
>and write code in that model to retrive data from the "current"
>bid, and call .fireTableStructureChanged() to inform the table
>that it have to redraw itself from scratch?
It sounds like your original idea would be more appealing to me (above).
Create a TableModel to handle the data for each bid (which is made up of
2x24 dataset) and the data events for each bid (E.G. handling
fireTableStructureChange events when users add columns, etc). Create
separate instances of the TableModel for each bid. You only need to
maintain one class to deal with bid data.
If the generic JTable suits your needs, just use it on each tab or customize
one to handle your requirements (maybe the headers need to be fancy or the
cells need some color coded rendering). Again, only need to maintain one
class for a customized view and in each tab you can have an instance.
Hope this helps a little...
Best Regards,
Bryan Cooper