Auto Resize JTable Columns

This class auto resizes columns of a JTable, maximizing any non-used width columns and transferring those extra widths to other columns. This way, a column with a JCheckBox will have a width almost equal to that of a JCheckBox‘s width. The class TableColumnResizer contains one static method and you can pass the JTable object as the parameter. The code does the rest.

To use the method, do this:

Here is the code of the TableColumnResizer class.

Related Posts Plugin for WordPress, Blogger...


  1. This is a good posting, I was wondering if I could use this summary on my website, I will link it back to your website though. If this is a problem please let me know and I will take it down right away.

Leave a Reply

Your email address will not be published. Required fields are marked *