You should use a JFormattedTextField
instead.
private DecimalFormatSymbols dfs;
private DecimalFormat dFormat;
dfs = new DecimalFormatSymbols();
dfs.setDecimalSeparator('.'); //separator for the decimals
dfs.setGroupingSeparator(','); //separator for the thousands
dFormat = new DecimalFormat ("#0.##", dfs);
JFormattedTextField ftf = new JFormattedTextField(dFormat);
Here's a link about customizing the format.