Package org.jdesktop.swingx.text
Class StrictNumberFormatter
- java.lang.Object
-
- javax.swing.JFormattedTextField.AbstractFormatter
-
- javax.swing.text.DefaultFormatter
-
- javax.swing.text.InternationalFormatter
-
- javax.swing.text.NumberFormatter
-
- org.jdesktop.swingx.text.StrictNumberFormatter
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class StrictNumberFormatter extends javax.swing.text.NumberFormatter
Experiment to work around Issue #1183-swingx: NumberEditorExt throws exception on getCellValue. Remaining issue: no visual error feedback if the expected number type exceeds its range.- Author:
- Jeanette Winzenburg
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StrictNumberFormatter(java.text.NumberFormat format)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setMaximum(java.lang.Comparable max)
void
setMinimum(java.lang.Comparable minimum)
void
setValueClass(java.lang.Class<?> valueClass)
java.lang.Object
stringToValue(java.lang.String text)
Returns theObject
representation of theString
text
, may be null.-
Methods inherited from class javax.swing.text.InternationalFormatter
clone, getActions, getFields, getFormat, getMaximum, getMinimum, install, valueToString
-
Methods inherited from class javax.swing.text.DefaultFormatter
getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getNavigationFilter, getOverwriteMode, getValueClass, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode
-
-
-
-
Method Detail
-
setValueClass
public void setValueClass(java.lang.Class<?> valueClass)
Overridden to automatically set the minimum/maximum to the boundaries of the Number type if it corresponds to a raw type, or null if not.
- Overrides:
setValueClass
in classjavax.swing.text.DefaultFormatter
-
setMaximum
public void setMaximum(java.lang.Comparable max)
- Overrides:
setMaximum
in classjavax.swing.text.InternationalFormatter
-
setMinimum
public void setMinimum(java.lang.Comparable minimum)
- Overrides:
setMinimum
in classjavax.swing.text.InternationalFormatter
-
stringToValue
public java.lang.Object stringToValue(java.lang.String text) throws java.text.ParseException
Returns theObject
representation of theString
text
, may be null.- Overrides:
stringToValue
in classjavax.swing.text.InternationalFormatter
- Parameters:
text
-String
to convert- Returns:
Object
representation of text- Throws:
java.text.ParseException
- if there is an error in the conversion
-
-