JTable cell editor number format
I need to show numbers in jTable with exact 2 decimal places. To accomplish this I have created a custom cell editor as: public class NumberCellEditor extends DefaultCellEditor { public NumberCellEditor(){ super(new JFormattedTextField()); } public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { JFormattedTextField editor = (JFormattedTextField) super.getTableCellEditorComponent(table, value, isSelected, row, column); if (value!=null){ DecimalFormat numberFormat = new DecimalFormat("#,##0.00;(#,##0.00)"); editor.setFormatterFactory