I have written a program that reads a csv file and put it into a jTable that will be displayed in a seperate jFrame as a preview. Everything works fine but I would like to use the optimal size for the jTable in the preview frame. 
So how to do it? Because if for example I choose another font for the text, the column would be wider or smaller? Is there a method to get the text-length in pixels (size)?`
The class looks like this:
Thanks
 
     
     
    