I have a JTable with multiple columns that display doubles, some of which are ratios, and others of which are dollar values. I'd like to specify a TableCellRenderer to be used for the ratios, and another for the dollar values.
The java tutorials say "To specify that cells in a particular column should use a renderer, you use the TableColumn method setCellRenderer". This is helpful, but it's unclear to me at what point I ought to call this method on my TableColumns. Is there a standard way of doing this? Should I make a custom JTable that does this in its constructor? Or a custom TableColumnModel? Ideally I'd like to be able to do this from the custom TableModel that I already have, though it seems unlikely that this possible.
Any help would be appreciated. Thanks