Class RegexFormatter

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public class RegexFormatter
    extends javax.swing.text.DefaultFormatter
    From an early Java example, later at http://www.oracle.com/technetwork/java/reftf-138955.html# Example: new JFormattedTextField(new jmri.util.swing.RegexFormatter("[A-Za-z]\\d*"));
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.regex.Matcher getMatcher()  
      java.util.regex.Pattern getPattern()  
      protected void setMatcher​(java.util.regex.Matcher matcher)  
      void setPattern​(java.util.regex.Pattern pattern)  
      java.lang.Object stringToValue​(java.lang.String text)  
      • Methods inherited from class javax.swing.text.DefaultFormatter

        clone, getAllowsInvalid, getCommitsOnValidEdit, getDocumentFilter, getNavigationFilter, getOverwriteMode, getValueClass, install, setAllowsInvalid, setCommitsOnValidEdit, setOverwriteMode, setValueClass, valueToString
      • Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter

        getActions, getFormattedTextField, invalidEdit, setEditValid, uninstall
      • Methods inherited from class java.lang.Object

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

      • RegexFormatter

        public RegexFormatter​(java.lang.String pattern)
                       throws java.util.regex.PatternSyntaxException
        Throws:
        java.util.regex.PatternSyntaxException
      • RegexFormatter

        public RegexFormatter​(java.util.regex.Pattern pattern)
    • Method Detail

      • setPattern

        public void setPattern​(java.util.regex.Pattern pattern)
      • getPattern

        public java.util.regex.Pattern getPattern()
      • setMatcher

        protected void setMatcher​(java.util.regex.Matcher matcher)
      • getMatcher

        protected java.util.regex.Matcher getMatcher()
      • stringToValue

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