I have a table with 3 columns and want the first to be the minimum size. The title is βLevelβ and is 25-29 pixels depending on the font / OS used. However, the table title requires at least 35 on Windows and 52 on the Mac to display it without ellipses. I canβt understand why additional space is needed (no border, etc.).
Finally, I found that the following will provide the required size on Windows (35), but on Mac it returns 36, which is not enough (most likely due to the fact that the sort arrow is next to and not above the text) ...
table.getTableHeader (). GetDefaultRenderer (). GetTableCellRendererComponent (zero, table.getColumnModel (). GetColumn (0) .getHeaderValue (), false, false, 0, 0) .getPreferredSize (). Width
What is the right way to make this platform independent? Or, is there a way on the Mac to calculate the extra space needed so that I don't have to hardcode something like adding 15 or so pixels to the above result?
source
share