简体   繁体   中英

JFormattedTextField removes fraction part

Whenever I enter any number with a fraction for example 50.25 the fraction part gets removed to 50.00.

DecimalFormat decimalFormat = new DecimalFormat("#,##0.00");
NumberFormatter currencyFormatter = new NumberFormatter(decimalFormat);
currencyFormatter.setMinimum(0);

JFormattedTextField AmountField = new JFormattedTextField(currencyFormatter);

How can I fix it to accept fraction numbers?

Changing setMinimum value solved the problem:

currencyFormatter.setMinimum(0.00);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM