Back Back

Number Fields (based on JFormattedTextField)

The SoftSmithy Utility Library provides various number fields based on the JFormattedTextField. These number fields can be devided in two categories: The whole-number fields as well as the real number fields support properties for the maximum and the minimum values allowed to be either set programmatically or entered by the user. If the value of the number field would be greater than the maximum value, it is set to the maximum value instead. If the value of the number field would be smaller than the minimum value, it is set to the minimum value instead. The maximum value for the maximum value and the minimum value for the minimum value are field specific and can be null if there are no maximum maximum or minimum minimum values.

A snapshot of the NumberFieldsSample



Try this:
  1. using Java Web Start.
  2. Type into the fields. Only values of the accordant type are accepted.

Below is the code from NumberFieldsSample.java that sets up the non-localized real number fields:
            
        

The Whole-Number Fields

The base class of the whole-number fields is the JWholeNumberField, which is backed up by the BigInteger class. Thus this field can be used for arbitrary big whole-numbers.

For each whole-number primitive type there is a number field based on JWholeNumberField:

The Real Number Fields

The base class of the real number fields is the JRealNumberField, which is backed up by the BigDecimal class. Thus this field can be used for arbitrary big real numbers.

For each real number primitive type there is a number field based on JRealNumberField:

The Localized Real Number Fields

The base class of the localized real number fields is the JLocalizedRealNumberField, which is backed up by the BigDecimal class. Thus this field can be used for arbitrary big real numbers.

For each real number primitive type there is a number field based on JLocalizedRealNumberField:

Back Back