Class RangedNumberFormatter

java.lang.Object
javax.swing.JFormattedTextField.AbstractFormatter
javax.swing.text.DefaultFormatter
javax.swing.text.InternationalFormatter
javax.swing.text.NumberFormatter
org.gorpipe.querydialogs.RangedNumberFormatter
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class RangedNumberFormatter
extends javax.swing.text.NumberFormatter
A number formatter that can constrain values to a minimum and/or maximum value.
See Also:
Serialized Form
  • Constructor Summary

    Constructors 
    Constructor Description
    RangedNumberFormatter​(java.lang.Double min, java.lang.Double max)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object stringToValue​(java.lang.String text)  
    java.lang.String valueToString​(java.lang.Object value)  

    Methods inherited from class javax.swing.text.NumberFormatter

    setFormat

    Methods inherited from class javax.swing.text.InternationalFormatter

    clone, getActions, getFields, getFormat, getMaximum, getMinimum, install, setMaximum, setMinimum

    Methods inherited from class javax.swing.text.DefaultFormatter

    getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getNavigationFilter, getOverwriteMode, getValueClass, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode, setValueClass

    Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter

    getFormattedTextField, invalidEdit, setEditValid, uninstall

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RangedNumberFormatter

      public RangedNumberFormatter​(java.lang.Double min, java.lang.Double max)
      Parameters:
      min - the minimum allowed value (null permitted)
      max - the maximum allowed value (null permitted)
  • Method Details

    • stringToValue

      public java.lang.Object stringToValue​(java.lang.String text) throws java.text.ParseException
      Overrides:
      stringToValue in class javax.swing.text.InternationalFormatter
      Throws:
      java.text.ParseException
    • valueToString

      public java.lang.String valueToString​(java.lang.Object value) throws java.text.ParseException
      Overrides:
      valueToString in class javax.swing.text.InternationalFormatter
      Throws:
      java.text.ParseException