newbie
newbie

Reputation: 1980

Proper way setting the column width and row height of JTable

I have a custom table with dynamic width and height for each column and row. I also planning to use JTextField as TableCellRenderer.

Should I set the table row height and column width inside the render or inside the custom table?Or there is another place that I can place this?

Upvotes: 0

Views: 978

Answers (1)

MadProgrammer
MadProgrammer

Reputation: 347184

You can use JTable#setRowHeight(int, int) to set the height of individual rows and you will need to use the ColumnModel and obtain a reference to the TableColumn in order to change it's size.

Remember though, the size of a column may be affected by the autoResizeMode

Upvotes: 1

Related Questions