Hi All,
I searched and couldn't find an answer for this. By default column headers in a JTable are centered. How do I make certain column headers left or right justified instead?
TIA
Hi All,
I searched and couldn't find an answer for this. By default column headers in a JTable are centered. How do I make certain column headers left or right justified instead?
TIA
TableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setHorizontalAlignment(SwingConstants.RIGHT);
table.getColumn(id).setHeaderRenderer(renderer);
Or, if you don't have the column names available:
table.getColumnModel().getColumn(index).setHeaderRenderer(renderer);