This is my code:
// create the formatters, default, display, edit
NumberFormatter defaultFormatter = new NumberFormatter(new DecimalFormat("#.##"));
NumberFormatter displayFormatter = new NumberFormatter(new DecimalFormat("#.##€"));
NumberFormatter editFormatter = new NumberFormatter(new DecimalFormat("#.##"));
// set their value classes
defaultFormatter.setValueClass(Double.class);
displayFormatter.setValueClass(Double.class);
editFormatter.setValueClass(Double.class);
// create and set the DefaultFormatterFactory
DefaultFormatterFactory valueFactory = new DefaultFormatterFactory(defaultFormatter,displayFormatter,editFormatter);
jFormattedTextField4.setFormatterFactory(valueFactory);
jFormattedTextField1.setFormatterFactory(valueFactory);
I'm getting issues when the user input a value with a point, like (2.33) , the formatedtextfield change to (2€) and this is not suppose to, because the user entered a valid value. If the user input (2,33) the result is (2,33) and again is not suppose to, because should be (2.33)
Basically i always want the format (X.XX). Example:
input vs what i want: 2-2.00€ / 2,22-2.22€ / 312.54-312.54€ / 432-432.00€ / 2,2-2.20€
EDITED: one week ago this was working, after i mount this project in another windows the issue appear. At this time i have a portuguese keyboard. Is it possible that the issue is involved with any windows or system property?
Edited:I still looking for help. Anyone??? :s