posted 17 years ago
I had a similar problem. The way I dealt with it was to create a "controller" that was passed a JTable and a model containing the records and had a set "page" size which was the number of records displayed. The controller provided next() and previous() methods. When invoked the controller would remove all the existing rows, if any, and then add the next (or previous) page size records as rows. You could also eliminate the adding/removing and just update the cells.
You could certainly roll your own TableModel to do it too but I have concerns about it. I'm just not sure a TableModel should be taking on the responsibility of deciding which rows are visible at a given time. But that's just my initial reaction so take it for what it's worth.
[ December 29, 2005: Message edited by: Ken Blair ]