Java Code Examples for java.text.DecimalFormat.setCurrency()

The following are Jave code examples for showing how to use setCurrency() of the java.text.DecimalFormat class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: lams   File: CurrencyFormatter.java   Source Code and License Vote up 5 votes
@Override
protected NumberFormat getNumberFormat(Locale locale) {
	DecimalFormat format = (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
	format.setParseBigDecimal(true);
	format.setMaximumFractionDigits(this.fractionDigits);
	format.setMinimumFractionDigits(this.fractionDigits);
	if (this.roundingMode != null && roundingModeOnDecimalFormat) {
		format.setRoundingMode(this.roundingMode);
	}
	if (this.currency != null) {
		format.setCurrency(this.currency);
	}
	return format;
}