Do this
double x= 8.3;
Label dbl = new Label("dbllbl",""+x){
@Override
protected void onComponentTagBody(final MarkupStream
markupStream, final
ComponentTag openTag)
{
Object val =
getConverter().convert(getModelObjectAsString(),
Double.class);
final NumberFormat nf =
NumberFormat.getCurrencyInstance();
String newval = nf.format(val);
replaceComponentTagBody(markupStream, openTag,
newval);
}
};
If you want to vary the locale on some cond, just use the method
getCurrencyInstance(Locale inLocale) in NumberFormat class
-swaroop
tauren wrote:
>
> Does such a thing exist? I thought it did, but can't find it now.
>
> Basically, I want a Label that allows me to format floats/doubles as
> currency. I don't need i18n built in (for different currencies,
> etc.), just take double x=8.3 and output $8.30.
>
> Any pointers are appreciated! Thanks.
>
> Tauren
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Custom-label-for-number-and-currency-formatting--tf4564849.html#a13032472
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]