• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFormattedTextField for Number only  RSS feed

 
Vishal Patel
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to block charctor written in JFormattedTextField.

I had tried this.
JFormattedTextField(new MaskFormatter("#####"))
This blocks the Charctors.
But i must enter number with length of 5 digit.

I want make it with any length.

Plz help me.

Regards ,
Vishal Patel
 
Jim Williams
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured out you have to add this line also.

myTextField.setFocusLostBehavior(JFormattedTextField.COMMIT);

I found that you have to do this if your number of mask characters are > 1.
[ October 14, 2004: Message edited by: Jim Williams ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!