By default, JTable truncates strings which are too long for the cells with ellipses like this.
I would like to just clip, as in macOS's Console app.
I've seen a previous answer which allows for replacing the ellipses with something else via overriding LabelUI but I'm not sure (1) how to implement this with the DefaultTableCellRenderer and (2) I intend the app to be cross platform so I don't think I can override a specific class like MetalUI and expect it to work.


One idea could be to put the default installed renderer in a
JScrollPane. The reasoning behind this is that you do not need to customize the renderer which comes with theJTable(so this sounds promising for portability). TheJScrollPaneadditionally ensures that the default renderer (which is aJLabel) will never get a size smaller than its preferred (ie no text clipping). You just need to hide the scrollbars ofJScrollPane.Example code:
The result looks like this:
You can apply the exact same principle in the header too (as shown in the example code). This is also tested for Windows 10 system L&F, showing similar behaviour.
But it comes with some minor limitations which so far I failed to mitigate:
This method then seems to need some adjustments, but they in turn seem to be related with small issues in the borders.