From this forum post:
Create a class that extends DefaultTableCellRenderer
and implement the getTableCellRendererComponent()
method, something like:
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
JLabel renderedLabel = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
renderedLabel.setHorizontalAlignment(SwingConstant s.RIGHT);
return renderedLabel;
}
and install this renderer for the column in question.
Now you only need to make sure that each value has the same number of decimal places because for most fonts, all digits have the same width.