If you want the scroll bar not to jump up to the top and jump back down to the previous position, you can use the following workaround. You can programmatically select a new row, then the focus is switched to the view making the selected row now visible again.The working solution running safely on Java Swing’s Event Dispatch Thread (EDT) without risking a race-condition or deadlock with the EDT would be:
jscrollpane = javaObjectEDT(findjobj(src));
viewport = javaObjectEDT(jscrollpane.getViewport);
jtable = javaObjectEDT( viewport.getView );
jtable.scrollRowToVisible(row_ - 1);
It requires findjobj functionality, and works fine on Matlab R2017a. Other solutions exists but may risk race-conditions with the Event Dispatch Thread (EDT).
Best Answer