开发者

JScrollPane Movement Restriction Query?

开发者 https://www.devze.com 2023-04-05 20:47 出处:网络
I have JTable of order nxn with the JScrollPane size being JScrollPane jsc = new JScrollPane(table); jsc.setP开发者_如何学PythonreferredSize(new Dimension(500,700));

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号