【发布时间】:2010-02-11 02:03:41
【问题描述】:
在让 JFormattedTextField 与我的自定义格式一起使用感到非常沮丧之后,我想知道是否有使用正则表达式的 Formatter 或 FormatterFactory?
我的想法是,如果有,那么我可以将它包装在一个静态类中并像这样调用它:
mFormattedTextField.setFormatterFactory(
SomeStaticClass.getRegexFormatFactory("^(\\d{1,}h)(\\s([0-5])?[0-9]m)?$"));
查看我的previous question 了解更多背景信息:
" 我想使用 JFormattedTextField 允许用户将持续时间值输入到表单中。示例有效值是:2h 30m 72h 15m6h0h"
【问题讨论】:
标签: java regex time jformattedtextfield