GWT - DoubleBox with more than three decimal places

I am creating a user interface using GWT, and there are many double-value boxes, but when I set some variable that contains more than three decimal places, my DoubleBox does not accept and truncate the number, allowing only 3 places.

This is normal?

What is the best solution?

Thanks.

+4
source share
1 answer

As javadoc says, DoubleBox is a ValueBox using DoubleParser and DoubleRenderer . Those rely on NumberFormat.getDecimalFormat() , which will be trunking with three decimal places in most (if not all) locales (for the default locale: http://code.google.com/p/google-web-toolkit/source/ browse / trunk / user / src / com / google / gwt / i18n / client / constants / NumberConstantsImpl.properties )

If you need a different format, use a ValueBox with NumberFormatRenderer with your custom NumberFormat template (and either use DoubleParser or create your own Parser with your custom NumberFormat template),

+3
source

Source: https://habr.com/ru/post/1432043/


All Articles