Package org.opentrafficsim.swing.gui
Class OTSControlPanel.RegexFormatter
- java.lang.Object
-
- javax.swing.JFormattedTextField.AbstractFormatter
-
- javax.swing.text.DefaultFormatter
-
- org.opentrafficsim.swing.gui.OTSControlPanel.RegexFormatter
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Enclosing class:
- OTSControlPanel
static class OTSControlPanel.RegexFormatter extends DefaultFormatter
Extension of a DefaultFormatter that uses a regular expression.
Derived from http://www.java2s.com/Tutorial/Java/0240__Swing/RegexFormatterwithaJFormattedTextField.htm$LastChangedDate: 2018-10-11 22:54:04 +0200 (Thu, 11 Oct 2018) $, @version $Revision: 4696 $, by $Author: averbraeck $, initial version 2 dec. 2014
- Author:
- Peter Knoppers
-
-
Constructor Summary
Constructors Constructor Description RegexFormatter(String pattern)
Create a new RegexFormatter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
stringToValue(String text)
String
toString()
-
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
-
-
-
-
Constructor Detail
-
RegexFormatter
RegexFormatter(String pattern)
Create a new RegexFormatter.- Parameters:
pattern
- String; regular expression pattern that defines what this RexexFormatter will accept
-
-
Method Detail
-
stringToValue
public Object stringToValue(String text) throws ParseException
- Overrides:
stringToValue
in classDefaultFormatter
- Throws:
ParseException
-
-