I have a class which extends DefaultTableCellRenderer, which renders strings in a monospace font, with a particular color. By default, it appears that tabs are not rendered at all (0 spaces). How can I set the tab size and/or cause them to be rendered?
edits: By "tabs" I mean tab characters, which I would just like to be rendered as some number of spaces. Rewriting the string is an option, but I figured there was a better way.
DefaultTableCellRenderer is a JLabel and does what a JLabel will do. I suggest you make yourself a custom TableCellRenderer and return a JPanel with two or more JLabels laid out appropriately. Alternatively use a JComponent that overrides paintComponent to draw as you wish.
Note: attempting to use HTML in renderers is a really bad idea performance wise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With