I have a JScrollpane managing a (dynamic) JTable, and would like to scroll to the appropriate row when some action is taken. As stated above, my table is dynamic, and for the purpose of this example, let's say that it will display either 10 rows or 20 rows of data.
The problem is that my call to "getMaximum()" does not seem to give me the correct results:
JScrollBar theScrollBar =
double rowPosition =
( (i * 1.0) / sortModel.getRowCount() ) *
( (double)theScrollBar.getMaximum() );
I placed some debug in my code, and sortMode.getRowCount() DOES give me either 10 or 20, as expected. However, getMaximum seems to not know that the table is now 10 versus 20, or vice versa.