Align text in a JTable cell while maintaining JTable default renderer?
I have a JTable that does lovely alternations in coloration thanks to this code: table.setDefaultRenderer(Object.class, new BorderRenderer(new ColorRenderer(table .getDefaultRenderer(Object.class), colorProvider))); (Here the "colorProvider" contains code that turns every other row light grey.) I have one column in which I would like to align text to center. If I simply set a DefaultCellRenderer on that column with center horizontal alignment, it overrides the table's default renderer and I lose my lovely stripes. Can I keep the stripes and still change the alignment of a column? To further