I'm creating an user interface using GWT and there're many boxes of double values but when I set some variable which contains more than 3 decimal places my DoubleBox doesn't accept and truncates the number letting just 3 places.
Is it normal?
What's the best solution?
Thank you.
As the javadoc says DoubleBox
is a ValueBox
using a DoubleParser
and DoubleRenderer
. Those rely on NumberFormat.getDecimalFormat()
which will trunk at 3 decimals 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 want another format, then use a ValueBox
with a NumberFormatRenderer
with your custom NumberFormat
pattern (and either use the DoubleParser
or make your own Parser
with your custom NumberFormat
pattern)