I want all commas in the cell in one specific column in JTable be under each other like example below. Does anyone know what should i change in my render?
1000,00
0,12
12,14
888,01
45,123
1458,11
Code:
TableColumn columnPrice = table.getColumnModel().getColumn(3);
TableCellRenderer priceRenderer = new TableCellRenderer() {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
String price = value.toString().replaceAll("\u20ac ","");
DecimalFormat decimalFormat = new DecimalFormat("###0.00");
String formatedValue = decimalFormat.format(Double.parseDouble(price));
WebLabel label = new WebLabel(formatedValue,SwingConstants.CENTER);
return label;
}
};
columnPrice.setCellRenderer(priceRenderer);