How to provide pagination support to a JTable in Swing?

Paging in a Swing JTable looks like a nice article.

Here is an excerpt:

As far as I remember the solution for this problem lies in the concept of paging: just retrieve the data that the user wants to see and nothing more. This also means you have to sometimes get extra data from the db server (or appserver) if your user scrolls down the list.

Big was my surprise that there wasn’t really an out-of-the-box solution (not even a copy- paste solution) for this problem. Anyone that knows one, please don’t hesitate to extend my (rather limited) knowledge of the J2EE platform.

So we dug in, and tried to build a solution ourselves.
What we eventually came up with was an adapted TableModel class to takes care of the paging.

Leave a Comment