I have a JTable and, inside its TableModel, I saved an int; this is the row index that I want my view to “keep in the middle” of the Viewport.
What I mean is that, for example, if I have 1000 rows, 10 are shown in the View at any time and my index is 500, I want my vieport to automatically show rows 495-504.
These rows are not necessarily selected.
I hope I was able to explain my problem properly.
Thank you
Assuming your row heights are the same,
If the row heights aren’t the same, you would have to sum all of the row heights from row 1 to row index – 5.