jformattedtextfield

    17热度

    3回答

    在这个问题中Is there any way to accept only numeric values in a JTextField?其中一个答案表明JFormattedTextField有问题。 我还没有使用它,但有人可能请扩展(或不同意)在这个类的问题?

    7热度

    3回答

    我在程序中使用了几个JFormattedTextField。出于某种原因,当文本字段点击文本字段后,文本字段获得焦点时,插入符总是跳到左侧(位置0)。我希望插入符号最终位于用户点击的位置。所以如果我在两位数之间点击,那么插入符应该在两位数之间结束。 所以我实现了一个FocusListener,它将得到点击位置并在那里设置插入符的位置。 FocusListener focusListener = n

    3热度

    2回答

    我正在使用NumberFormatter和JFormattedTextField,但.getValue()不会返回与用户所看到的值相同的值。 我认为输入字符串是使用NumberFormats parse-method解析的,我从NumberFormat.getNumberInstance();获得Numberformat与实际的Locale。所以我不认为我可以轻松扩展它并编写我自己的分析方法? 在

    3热度

    5回答

    我想使用JFormattedTextField来允许用户输入时间持续时间值到表单中。样本有效值为: 2h 30m 72h 15m 6h 0h 但是我有这个有限的成功。有人可以建议如何实现?如果使用JTextField也可以实现此结果,那么我很好。 谢谢! 如果这是值得任何东西,这是我当前的尝试: mFormattedText.setFormatterFactory( new Default

    6热度

    1回答

    在让JFormattedTextField与我的自定义格式一起工作之后,我想知道是否有使用正则表达式的Formatter或FormatterFactory? 我的想法是,如果有,那么我可以在一个静态类包装它并调用它像这样: mFormattedTextField.setFormatterFactory( SomeStaticClass.getRegexFormatFactory("^(\\