JScrollPane Movement Restriction Query?
I have JTable of order nxn with the JScrollPane size being
JScrollPane jsc = new JScrollPane(table);
jsc.setP开发者_如何学PythonreferredSize(new Dimension(500,700));
The Scenario is this:: whenever I edit the last cell (it contains a JTextField) of the JTable by dragging down the ScrollBar and come out of Focus, the ScrollBar slides back the original position, i.e the beginning position. I would like the ScrollBar be in the place where it was set by the user before and after editing.... how can this be achieved?
Thank You In Advance....
you can able to determine scrollToVisible(JTable table, int rowIndex, int vColIndex)
, example here
Because JTable
is a Scrolling-Savvy Client, it implements the Scrollable
interface. You may get better results using the method setPreferredScrollableViewportSize()
instead of calling setPreferredSize()
directly on the scroll pane.
精彩评论