Class NumberFormField<Type extends Number & Comparable<?>>
java.lang.Object
com.github.tadukoo.view.form.field.FormField<Type>
com.github.tadukoo.view.form.field.number.NumberFormField<Type>
- Type Parameters:
Type
- The type ofNumber
being stored in the field (used for default, min, max, and step values)
- Direct Known Subclasses:
DoubleFormField
,FloatFormField
,IntFormField
,LongFormField
,ShortFormField
- Since:
- Alpha v.0.2.1
- Version:
- Alpha v.0.3
- Author:
- Logan Ferree (Tadukoo)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
NumberFormField.NumberFormFieldBuilder<Type extends Number & Comparable<?>>
Builder to be used to create aNumberFormField
.Nested classes/interfaces inherited from class com.github.tadukoo.view.form.field.FormField
FormField.FormFieldBuilder<Type>
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
NumberFormField
(FieldType type, String key, Type defaultValue, LabelType labelType, SizablePaint labelForegroundPaint, SizablePaint labelBackgroundPaint, FontFamily labelFontFamily, int labelFontStyle, int labelFontSize, ShapeInfo labelShape, Border labelBorder, int rowPos, int colPos, int rowSpan, int colSpan, boolean logFontResourceLoaderWarnings, com.github.tadukoo.util.logger.EasyLogger logger, GraphicsEnvironment graphEnv, String fontFolder, FontResourceLoader fontResourceLoader, Type minValue, Type maxValue, Type stepSize) Creates a new NumberFormField with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Type
convertToType
(Number number) Used ingetValue(JComponent)
to convert theNumber
from theJSpinner
into the type used in this particular FormField.Creates theJComponent
to be used for this field.getValue
(JComponent component) Takes in theJComponent
for this field and grabs the data off of it, returning it in the proper format for the field to be repopulated on the form.Methods inherited from class com.github.tadukoo.view.form.field.FormField
getColPos, getColSpan, getDefaultValue, getFontFolder, getFontResourceLoader, getGraphEnv, getKey, getLabelBackgroundPaint, getLabelBorder, getLabelFontFamily, getLabelFontSize, getLabelFontStyle, getLabelForegroundPaint, getLabelShape, getLabelType, getLogger, getRowPos, getRowSpan, getType, logFontResourceLoaderWarnings
-
Field Details
-
minValue
The minimum value allowed for this field -
maxValue
The maximum value allowed for this field -
stepSize
The increment value for the spinner for this field
-
-
Constructor Details
-
NumberFormField
protected NumberFormField(FieldType type, String key, Type defaultValue, LabelType labelType, SizablePaint labelForegroundPaint, SizablePaint labelBackgroundPaint, FontFamily labelFontFamily, int labelFontStyle, int labelFontSize, ShapeInfo labelShape, Border labelBorder, int rowPos, int colPos, int rowSpan, int colSpan, boolean logFontResourceLoaderWarnings, com.github.tadukoo.util.logger.EasyLogger logger, GraphicsEnvironment graphEnv, String fontFolder, FontResourceLoader fontResourceLoader, Type minValue, Type maxValue, Type stepSize) Creates a new NumberFormField with the given parameters.- Parameters:
type
- TheFieldType
of this fieldkey
- The name of this field (used as a key inForms
)defaultValue
- The starting value of the fieldlabelType
- TheLabelType
to use for this fieldlabelForegroundPaint
- TheSizablePaint
for the foreground of the LabellabelBackgroundPaint
- TheSizablePaint
for the background of the LabellabelFontFamily
- TheFontFamily
for the Label's fontlabelFontStyle
- The font style for the LabellabelFontSize
- The font size for the LabellabelShape
- TheShapeInfo
to use for the LabellabelBorder
- TheBorder
to use for the LabelrowPos
- The row position of this fieldcolPos
- The column position of this fieldrowSpan
- The row span of this fieldcolSpan
- The column span of this fieldlogFontResourceLoaderWarnings
- Whether to log warnings generated by the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderlogger
- AnEasyLogger
that will be sent to the FontResourceLoader by default - can be ignored if you specify your own FontResourceLoadergraphEnv
- TheGraphicsEnvironment
to load a font to in the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderfontFolder
- The path to the fonts folder to find font files in if needed in the FontResourceLoader - can be ignored if you specify your own FontResourceLoaderfontResourceLoader
- TheFontResourceLoader
to use for fonts on this fieldminValue
- The minimum value allowed for this fieldmaxValue
- The maximum value allowed for this fieldstepSize
- The increment value for the spinner for this field
-
-
Method Details
-
getMinValue
- Returns:
- The minimum value allowed for this field
-
getMaxValue
- Returns:
- The maximum value allowed for this field
-
getStepSize
- Returns:
- The increment value for the spinner for this field
-
getComponent
Creates theJComponent
to be used for this field.- Specified by:
getComponent
in classFormField<Type extends Number & Comparable<?>>
- Returns:
- A newly created
JComponent
to use on the form
-
getValue
Takes in theJComponent
for this field and grabs the data off of it, returning it in the proper format for the field to be repopulated on the form.- Specified by:
getValue
in classFormField<Type extends Number & Comparable<?>>
- Parameters:
component
- TheJComponent
associated with this field- Returns:
- The data extracted from the
JComponent
-
convertToType
Used ingetValue(JComponent)
to convert theNumber
from theJSpinner
into the type used in this particular FormField.
-