0

title is quite explanatory.

i got JTable wider than screen so there is horizontal scrollbar.

when i start app and try to resize column (via grabing table header) and resize it its cooperating.

when i move scrollbar and i try to resize some column, scrollbar jumps at the starting position - so i cant resize it since immediately as i try its moves scrollbar to total left when it is when i start an app.

i have no idea what could be wrong and where should i look to fix it.

i set resizability via:

TableColumn column = null;
for (int i = 0; i < table.getColumnCount(); i++) {
   column = table.getColumnModel().getColumn(i);        
   column.setResizable(true);       
...

then later in code there is scrolling added

table_scroll_pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
table_scroll_pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
camickr
  • 321,443
  • 19
  • 166
  • 288
  • 1
    So you are saying that if you try to resize a table column, your horizontal scrollbar jumps to the left side? If that is what you are saying, I cannot reproduce this. Please post a [mre] that demonstrates the issue. – maloomeister May 11 '21 at 12:44
  • 1
    *title is quite explanatory.* - no it isn't I can't reproduce the problem either. 1) there is no need to set the column resizable, that is the default. 2) there is no need to set the scrollbar policy, that is also the default. Every question should have an "MRE" as defined in the link above. – camickr May 11 '21 at 14:45
  • Indeed time for a minimal example that shows the problem. Because I've been code Swing for 20 years now and never seen that behavior. – tbeernot May 11 '21 at 20:25

0 Answers0