I am trying to resize the widths of the columns in a JTable.
I would need to resize them when the program is running to see the full column header names.
I want to resize table of database showing in swing frame.
I have tried
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS)
But i dont get the desired output becouse when i use this i have a horizontal scrollbar to scroll to the columns that are off screen. But i want that the size of the whole table should become approximately equal to the size of frame.
How can I make the columns as wide as they need to be to display all the text?
Please answer as soon as possible.