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 extend
Use the locale to your advantage:
//Locale myLocale = Locale.GERMANY; //... or better, the current Locale
Locale myLocale = Locale.getDefault(); // better still
NumberFormat numberFormatB = NumberFormat.getInstance(myLocale);
numberFormatB.setMaximumFractionDigits(2);
numberFormatB.setMinimumFractionDigits(2);
numberFormatB.setMinimumIntegerDigits(1);
edit.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(
new NumberFormatter(numberFormatB)));