File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validate JTextfield input

 
Sarone Thach
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Does anyone know of an easy way of validating the JTextfield input. I would like to only permit numbers in the JTextfield, and deleting any character strings the user have entered. If possible, preventing the string to be displayed at all.
thanks in advanced for your help.
Sarone
 
Sainath Veepuri
Ranch Hand
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sarone,
write a utility class which extends javax.swing.text.PlainDocument and override the insertString method and define it the way you want.Finally set the document for ur jtextfield.
Thanks,
Sai
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic