javax.swing.text

Class NumberFormatter

public class NumberFormatter extends InternationalFormatter

NumberFormatter is an {@link InternationalFormatter} that implements value to string and string to value conversion via an instance of {@link NumberFormat}.

Since: 1.4

Constructor Summary
NumberFormatter()
Creates a NumberFormatter with the default NumberFormat from NumberFormat.getNumberInstance().
NumberFormatter(NumberFormat format)
Creates a NumberFormatter with the specified NumberFormat.
Method Summary
voidsetFormat(Format format)
Sets the NumberFormat that this NumberFormatter will use to determine legal values for editing and displaying.

Constructor Detail

NumberFormatter

public NumberFormatter()
Creates a NumberFormatter with the default NumberFormat from NumberFormat.getNumberInstance().

NumberFormatter

public NumberFormatter(NumberFormat format)
Creates a NumberFormatter with the specified NumberFormat.

Parameters: format the NumberFormat to use for this NumberFormatter.

Method Detail

setFormat

public void setFormat(Format format)
Sets the NumberFormat that this NumberFormatter will use to determine legal values for editing and displaying.

Parameters: format the Format to use to determine legal values.