Scenario:
you are using a JTable with a custom TableModel to view the contents of some collection located in a database or on the network or whatever.
The brute force way to make this work is to load the whole collection at once. Let's say that isn't practical because of the resources needed.
The simple way around that problem is to fetch rows on demand, one row at a time, as the JTable renders each row, and calls TableModel.getValueAt(); cache as necessary. This causes a lot of hits to the database, though.
Is there a way to listen to scroll/viewport events for a JTable, to figure out what rows it is going to display before it renders each cell? If so, I would like to intercept and cause my custom TableModel to prefetch one page at a time.
edit: just to clarify, the point here is to be able to fetch the contents of a group of visible table rows in one batch, rather than having to fetch the contents of each row by itself.