java - How to use JFormattedTextField to allow only alphabets? -


i searched solution everywhere, found solutions allowing numbers, alphanumeric (using documentfilter).

but, need allow alphabets , intend use jformattedtextfield due advantages.

so, how use jformattedtextfield allow alphabets (a-za-z) (no space, punctuation, letters)!

since number variable, , if i'm not wrong jformattedtextfield uses masks fixed length of digits, more easy use litener change text event , validate text in element removing unallowed characters.

something that:

jtextfield f = null;  f.getdocument().adddocumentlistener(new documentlistener() {   @override   public void insertupdate(documentevent e)   {     validateinputtext();   }    @override   public void removeupdate(documentevent e)   {     validateinputtext();   }    @override   public void changedupdate(documentevent e)   {     validateinputtext();   } }); 

Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -