I want to put a String in a JTable that is longer than the given cell-width.
How can I set the rowHeight dynamically so that I can read the whole S
Normally we are setting the RowHeight when the text in the row goes beyond the height of a row, to set the height of a row we do this:
table.setRowHeight(40);
I want to put a String in a JTable that is longer than the given cell-width. How can I set the rowHeight dynamically so that I can read the whole String?
To read complete string from the jtable row you don't need to set RowHeight you need to set the PreferredWidth of a column as you are already doing so. Just add a line like:
textTable.getColumnModel().getColumn(2).setPreferredWidth(300);
And you will be able to read the whole string.
Output
