After much frustration with getting a JFormattedTextField to work with my custom formats, I was wondering if there was a Formatter
or FormatterFactory
that uses regular expressions?
My idea is that if there is one, then I could wrap it in a static class and invoke it like so:
mFormattedTextField.setFormatterFactory(
SomeStaticClass.getRegexFormatFactory("^(\\d{1,}h)(\\s([0-5])?[0-9]m)?$"));
See my previous question for more background:
" I want to use a JFormattedTextField to allow the user to input time duration values into a form. Sample valid values are: 2h 30m
72h 15m
6h
0h
"