Package jmri.util.swing
Class RegexFormatter
- java.lang.Object
-
- javax.swing.JFormattedTextField.AbstractFormatter
-
- javax.swing.text.DefaultFormatter
-
- jmri.util.swing.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
-
-
Constructor Summary
Constructors Constructor Description RegexFormatter()
RegexFormatter(java.lang.String pattern)
RegexFormatter(java.util.regex.Pattern pattern)
-
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
-
-
-
-
Constructor Detail
-
RegexFormatter
public RegexFormatter()
-
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 classjavax.swing.text.DefaultFormatter
- Throws:
java.text.ParseException
-
-