G
Gerhard Rapp
Hi all.
I try to automatically adjust the column widths of a JTable according to
their content. My ideas were (1) to search the longest entry for each column
by going through all entries. (Which is pretty slow for long tables) And (2)
to adapt the getValueAt function to detect and store the longest entry for
each column, so I can set these values when the table is displayed the first
time. Btw. which event handler will I have to use here?
I guess some of you have faced this problem before. What are your solutions?
In this context I have another question? If the sum of the column widths is
greater than the width of the table's scroll pane one has to set the
autoresize strategy property of the table to OFF. If the total width is less
than the scroll panes' width one gets an annoying border around the table.
How can I prevent this? Apart from adding a dummy column at the right. And
what about the rows?
Thanks
Gerhard
I try to automatically adjust the column widths of a JTable according to
their content. My ideas were (1) to search the longest entry for each column
by going through all entries. (Which is pretty slow for long tables) And (2)
to adapt the getValueAt function to detect and store the longest entry for
each column, so I can set these values when the table is displayed the first
time. Btw. which event handler will I have to use here?
I guess some of you have faced this problem before. What are your solutions?
In this context I have another question? If the sum of the column widths is
greater than the width of the table's scroll pane one has to set the
autoresize strategy property of the table to OFF. If the total width is less
than the scroll panes' width one gets an annoying border around the table.
How can I prevent this? Apart from adding a dummy column at the right. And
what about the rows?
Thanks
Gerhard