you can override the method getConverter(Class) and return customized
converter.
i use a "DoubleLabel" to always show 2 fraction digits:

private static class DoubleLabel extends Label {

        // constructors ....

        public IConverter getConverter(Class clazz) {
            DoubleConverter converter = (DoubleConverter)
DoubleConverter.INSTANCE;
            NumberFormat format = converter.getNumberFormat(getLocale());
            format.setMinimumFractionDigits(2);
            converter.setNumberFormat(getLocale(), format);
            return converter;
        }

    }

this can probably be optimized to not always create a converter but rather
save it as a property of the label, ...

you get the idea.

  gerolf

On 10/2/07, Artur W. <[EMAIL PROTECTED]> wrote:
>
>
> Hi!
>
> TextField rounds doubles values up to 3 fraction digits. Why?
>
> For example
>
> container.add(new TextField("price", new PropertyModel(this, "price"),
> Double.class));   //price = 0,96104
> gives 0,961.
>
>
> How to change it?
>
> Thanks,
> Artur
>
> --
> View this message in context:
> http://www.nabble.com/TextField-rounds-doubles%2C-why--tf4554400.html#a12997105
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to