Package ca.corbett.forms.fields
Class NumberField
java.lang.Object
ca.corbett.forms.fields.FormField
ca.corbett.forms.fields.NumberField
A FormField that wraps a JSpinner to allow numeric input.
The underlying JSpinner is accessible by invoking getFieldComponent() and
casting the result to JSpinner.
- Since:
- 2020-09-25
- Author:
- scorbo2
-
Field Summary
Fields inherited from class ca.corbett.forms.fields.FormField
DEFAULT_FONT, defaultFont, extraAttributes, fieldComponent, fieldLabel, fieldValidators, helpLabel, identifier, isEnabled, isVisible, margins, validationLabel, valueChangedListeners -
Constructor Summary
ConstructorsConstructorDescriptionNumberField(String labelText, double initialValue, double minimum, double maximum, double step) Creates a floating point NumberField using the given starting values.NumberField(String labelText, int initialValue, int minimum, int maximum, int step) Creates an integer-based NumberField using the given starting values.NumberField(String labelText, SpinnerModel model) Creates a NumberField using the given SpinnerModel. -
Method Summary
Methods inherited from class ca.corbett.forms.fields.FormField
addAllExtraAttributes, addFieldValidator, addValueChangedListener, clearExtraAttribute, clearExtraAttributes, clearValidationResults, equals, fireValueChangedEvent, getDefaultFont, getExtraAttribute, getFieldComponent, getFieldLabel, getHelpLabel, getHelpText, getIdentifier, getMargins, getValidationLabel, hasFieldLabel, hashCode, hasHelpLabel, hasValidationLabel, isEnabled, isMultiLine, isValid, isVisible, preRender, removeAllFieldValidators, removeFieldValidator, removeValueChangedListener, setAllExtraAttributes, setDefaultFont, setEnabled, setExtraAttribute, setFieldLabelFont, setHelpText, setIdentifier, setMargins, setVisible, shouldExpand, validate
-
Constructor Details
-
NumberField
Creates an integer-based NumberField using the given starting values.- Parameters:
labelText- The label to show for the field.initialValue- The starting value.minimum- The minimum value.maximum- The maximum value.step- The increment value.
-
NumberField
public NumberField(String labelText, double initialValue, double minimum, double maximum, double step) Creates a floating point NumberField using the given starting values.- Parameters:
labelText- The label to show for the field.initialValue- The starting value.minimum- The minimum value.maximum- The maximum value.step- The increment value.
-
NumberField
Creates a NumberField using the given SpinnerModel. Normally you can use the other constructors in this class as a convenience to avoid having to create the SpinnerModel yourself, but this constructor is useful if you want to be able to change the parameters of the spinner dynamically, for example to change the increment or to set a new min or max value.- Parameters:
labelText- The label to show for the field.model- A SpinnerModel instance containing our spinner parameters.
-
-
Method Details
-
getCurrentValue
-
setCurrentValue
-