显示可编辑整数数组的java最佳格式化程序?(可能以0开头)
我使用JFormattedTextField作为其容器。我不知道如何使用NumberFormatter,它会将所有内容转换为int,所以。。是 啊也不能用MaskFormatter实现,它强制输入与原始掩码匹配,在我的例子中是8位(“#######”)。任何位数(最多8位)都可以。请帮忙
编辑:
你可以在下面搜索框中键入要查询的问题!
我使用JFormattedTextField作为其容器。我不知道如何使用NumberFormatter,它会将所有内容转换为int,所以。。是 啊也不能用MaskFormatter实现,它强制输入与原始掩码匹配,在我的例子中是8位(“#######”)。任何位数(最多8位)都可以。请帮忙
编辑:
# 1 楼答案
只需使用^{} (对于文本字段的底层文档)过滤掉不是数字的任何内容,也可以过滤掉导致文本字段文档长度超过8的任何内容
这里有一个例子