java - JTable resize table header does autoscroll -


this issue. have code below. when drag column on edge of panel, panel scrolls itself.

however, problem is, feature, every time resize column width, panel scrolls top.

for example, have 1000 rows , highlight 999th row @ bottom. when resize column width, panel scrolls top. how make panel stay @ wherever was?

i want table autoscroll horizontally, not vertically.

table.gettableheader().addmousemotionlistener(new mousemotionadapter() {     public void mousedragged(mouseevent e)     {         rectangle r = new rectangle(e.getx(), e.gety(), 1, 1);         ((jtableheader)e.getsource()).scrollrecttovisible(r);         table.scrollrecttovisible(r);     } }); 

you resetting jtable's scroll bar position statement:

table.scrollrecttovisible(r);

here x position of rectangle correct, same jtableheader , jtable. y position should different both. using y position jtableheader jtable also.

to make work correctly, y position of jviewport of jscrollpane used jtable. use y position rectangle used in above statement. should correct issue.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -