I was hoping somebody could help me with some formatting issues I am finding with a table I am using. I have table component that I would like the header to be centered and word wrapped. I added html to the header to center and break the two words into separate lines but the text doesn’t exactly center. it is especially noticeable when resizing the cell. Anybody have a suggestion as to what I can do to get it to center?
Hmmm. That space is reserved for a “sort” indicator arrow, if I recall correctly. You could dig around in Java Swing’s JTable.setTableHeader() method documentation to try to substitute one that centers the way you wish.
You’ll probably want this to fire automatically - probably on propertyChange of the data attribute, but this should get you started. table.getColumnModel().getColumn(1) sets the index of the column to modify (from 0, counting from left to right).
To kind of follow up what you had posted here about the centering, could I do something similar to modify the header’s color and line type? I would like it to have a plain line instead of what appears to be an etched or beveled line.