Search code examples
javaswingjtablejtableheader

autofit table header width as text in java


how can I make the table header width that fits only text? Means table column header width varies as name of the columns.


Solution

  • Check out the Table Column Adjuster. You can set the width of each TableColumn to be based on the text:

    1. in the header
    2. in the row data
    3. in the header and the row data