At what classes should one look at (research) when trying to change the alignment of the header text for a specific column in a JTable? I figured out how to change the entire JTableHeader text aligment through the getDefaultRenderer(), but I cannot figure out how to make certain column headers to be aligned left, while others are right. Any help would be appreciated.
If you're ok with relying on implementation detail, you can wrap the table header's default renderer something likeOnly tested under MetalLookAndFeel. Use the idea at your own risk.
edit Should have mentioned clearly that the implementation detail this relies on is that a table header's default renderer (like most default cell renderers) extends JLabel.
Another approach independent of implementation detail is to use my Default Table Header Cell Renderer class. (The class doesn't respect custom foreground/background settings on the table header, but that's a 3-line fix if you need it.)
There are no new questions, but there may be new answers.
Thank you very much, that is exactly it!!! Im using the system's default lookandfeel, so, as you pointed out, it is not garunteed to work 100% of the`time, but i would think it would work for most. Thanks!
subject: in a JTable, changing column header text alignment for specific columns only