简体   繁体   English

maskformatter Java数字和空格

[英]maskformatter java number and space

I used maskformatter for my jtextfield. 我为我的jtextfield使用maskformatter。

It works like a charm but the problem is that I cant delete the number in the jtextfield. 它的工作原理就像一种魅力,但问题是我无法删除jtextfield中的数字。

f = new MaskFormatter( "#" );
f.setValidCharacters("123456789");

How can I include the space character so that I can accept space and digits from 1-9? 如何包含空格字符,以便可以接受1-9之间的空格和数字?

f = new MaskFormatter( "*" );
f.setValidCharacters("123456789 ");

accept all characters and include space.. 接受所有字符并包含空格。

This works for me 这对我有用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM